@@ -266,48 +266,48 @@ impl GenServer for RLPxConnection {
266
266
message : Self :: CastMsg ,
267
267
_handle : & RLPxConnectionHandle ,
268
268
) -> CastResponse {
269
- if let InnerState :: Established ( mut established_state) = self . inner_state . clone ( ) {
269
+ if let InnerState :: Established ( ref mut established_state) = self . inner_state {
270
270
let peer_supports_l2 = established_state. l2_state . connection_state ( ) . is_ok ( ) ;
271
271
let result = match message {
272
272
Self :: CastMsg :: PeerMessage ( message) => {
273
273
log_peer_debug (
274
274
& established_state. node ,
275
275
& format ! ( "Received peer message: {message}" ) ,
276
276
) ;
277
- handle_peer_message ( & mut established_state, message) . await
277
+ handle_peer_message ( established_state, message) . await
278
278
}
279
279
Self :: CastMsg :: BackendMessage ( message) => {
280
280
log_peer_debug (
281
281
& established_state. node ,
282
282
& format ! ( "Received backend message: {message}" ) ,
283
283
) ;
284
- handle_backend_message ( & mut established_state, message) . await
284
+ handle_backend_message ( established_state, message) . await
285
285
}
286
286
Self :: CastMsg :: SendPing => {
287
- send ( & mut established_state, Message :: Ping ( PingMessage { } ) ) . await
287
+ send ( established_state, Message :: Ping ( PingMessage { } ) ) . await
288
288
}
289
289
Self :: CastMsg :: SendNewPooledTxHashes => {
290
- send_new_pooled_tx_hashes ( & mut established_state) . await
290
+ send_new_pooled_tx_hashes ( established_state) . await
291
291
}
292
292
Self :: CastMsg :: BroadcastMessage ( id, msg) => {
293
293
log_peer_debug (
294
294
& established_state. node ,
295
295
& format ! ( "Received broadcasted message: {msg}" ) ,
296
296
) ;
297
- handle_broadcast ( & mut established_state, ( id, msg) ) . await
297
+ handle_broadcast ( established_state, ( id, msg) ) . await
298
298
}
299
299
Self :: CastMsg :: BlockRangeUpdate => {
300
300
log_peer_debug ( & established_state. node , "Block Range Update" ) ;
301
- handle_block_range_update ( & mut established_state) . await
301
+ handle_block_range_update ( established_state) . await
302
302
}
303
303
Self :: CastMsg :: L2 ( msg) if peer_supports_l2 => {
304
304
log_peer_debug ( & established_state. node , "Handling cast for L2 msg: {msg:?}" ) ;
305
305
match msg {
306
306
L2Cast :: BatchBroadcast => {
307
- l2_connection:: send_sealed_batch ( & mut established_state) . await
307
+ l2_connection:: send_sealed_batch ( established_state) . await
308
308
}
309
309
L2Cast :: BlockBroadcast => {
310
- l2:: l2_connection:: send_new_block ( & mut established_state) . await
310
+ l2:: l2_connection:: send_new_block ( established_state) . await
311
311
}
312
312
}
313
313
}
@@ -345,15 +345,11 @@ impl GenServer for RLPxConnection {
345
345
}
346
346
}
347
347
}
348
-
349
- // Update the state
350
- self . inner_state = InnerState :: Established ( established_state) ;
351
- CastResponse :: NoReply
352
348
} else {
353
349
// Received a Cast message but connection is not ready. Log an error but keep the connection alive.
354
350
error ! ( "Connection not yet established" ) ;
355
- CastResponse :: NoReply
356
351
}
352
+ CastResponse :: NoReply
357
353
}
358
354
359
355
async fn teardown ( self , _handle : & GenServerHandle < Self > ) -> Result < ( ) , Self :: Error > {
0 commit comments