Skip to content

Commit a9910e4

Browse files
committed
Move the sub match to avoid the unreachable
1 parent 580f921 commit a9910e4

File tree

1 file changed

+17
-15
lines changed
  • beacon_node/lighthouse_network/src/rpc

1 file changed

+17
-15
lines changed

beacon_node/lighthouse_network/src/rpc/mod.rs

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -509,26 +509,28 @@ where
509509
message: Ok(RPCReceived::Request(request)),
510510
}));
511511
}
512-
HandlerEvent::Ok(rpc) => {
513-
// Inform the limiter that a response has been received.
514-
match &rpc {
515-
RPCReceived::Request(_) => unreachable!(),
516-
RPCReceived::Response(_id, response) => {
517-
if response.protocol().terminator().is_none() {
518-
self.outbound_request_limiter
519-
.request_completed(&peer_id, response.protocol());
520-
}
521-
}
522-
RPCReceived::EndOfStream(_id, response_termination) => {
523-
self.outbound_request_limiter
524-
.request_completed(&peer_id, response_termination.as_protocol());
525-
}
512+
HandlerEvent::Ok(RPCReceived::Response(id, response)) => {
513+
if response.protocol().terminator().is_none() {
514+
// Inform the limiter that a response has been received.
515+
self.outbound_request_limiter
516+
.request_completed(&peer_id, response.protocol());
526517
}
527518

528519
self.events.push(ToSwarm::GenerateEvent(RPCMessage {
529520
peer_id,
530521
conn_id,
531-
message: Ok(rpc),
522+
message: Ok(RPCReceived::Response(id, response)),
523+
}));
524+
}
525+
HandlerEvent::Ok(RPCReceived::EndOfStream(id, response_termination)) => {
526+
// Inform the limiter that a response has been received.
527+
self.outbound_request_limiter
528+
.request_completed(&peer_id, response_termination.as_protocol());
529+
530+
self.events.push(ToSwarm::GenerateEvent(RPCMessage {
531+
peer_id,
532+
conn_id,
533+
message: Ok(RPCReceived::EndOfStream(id, response_termination)),
532534
}));
533535
}
534536
HandlerEvent::Err(err) => {

0 commit comments

Comments
 (0)