Skip to content

Commit

Permalink
fix: handle unimplemented message types and errors
Browse files Browse the repository at this point in the history
  • Loading branch information
rgbkrk committed Dec 30, 2024
1 parent de70ebe commit 1d4cb54
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,11 +68,22 @@ impl SocketRecv for RouterSocket {
message.push_front(peer_id.into());
return Ok(message);
}
Some((_peer_id, Ok(msg))) => todo!("Unimplemented message: {:?}", msg),
Some((peer_id, Err(_))) => {
Some((_peer_id, Ok(_msg))) => {
// todo: Log or handle other message types if needed
// We could take an approach of using `tracing` and have that be an optional feature
// tracing::warn!("Received unimplemented message type: {:?}", msg);
continue;
}
Some((peer_id, Err(_e))) => {
self.backend.peer_disconnected(&peer_id);
// We could take an approach of using `tracing` and have that be an optional feature
// tracing::error!("Error receiving message from peer {}: {:?}", peer_id, e);
continue;
}
None => {
// The fair queue is empty, which shouldn't happen in normal operation
return Err(ZmqError::NoMessage);
}
None => todo!(),
};
}
}
Expand Down

0 comments on commit 1d4cb54

Please sign in to comment.