aboutsummaryrefslogtreecommitdiff
path: root/jsonrpc
diff options
context:
space:
mode:
authorhozan23 <hozan23@karyontech.net>2024-07-04 14:01:44 +0200
committerhozan23 <hozan23@karyontech.net>2024-07-04 14:01:44 +0200
commit6c65232d741229635151671708556b9af7ef75ac (patch)
tree7c6e458adcf5a708e4fd11ca6644474e538202bf /jsonrpc
parent264cd36bed4c66a1b66be808caf45487996a8ce9 (diff)
jsonrpc/server: Remove panic on peer endpoint retrieval during incoming connection handling
Diffstat (limited to 'jsonrpc')
-rw-r--r--jsonrpc/src/server/mod.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/jsonrpc/src/server/mod.rs b/jsonrpc/src/server/mod.rs
index 50a4a8e..ed027f5 100644
--- a/jsonrpc/src/server/mod.rs
+++ b/jsonrpc/src/server/mod.rs
@@ -113,8 +113,8 @@ impl Server {
/// Handles a new connection
async fn handle_conn(self: &Arc<Self>, conn: Conn<serde_json::Value>) -> Result<()> {
- let endpoint = conn.peer_endpoint().expect("get peer endpoint");
- debug!("Handle a new connection {endpoint}");
+ let endpoint: Option<Endpoint> = conn.peer_endpoint().ok();
+ debug!("Handle a new connection {:?}", endpoint);
let conn = Arc::new(conn);
@@ -171,9 +171,9 @@ impl Server {
let chan = channel.clone();
let on_complete = |result: TaskResult<Result<()>>| async move {
if let TaskResult::Completed(Err(err)) = result {
- error!("Connection {} dropped: {}", endpoint, err);
+ error!("Connection {:?} dropped: {err}", endpoint);
} else {
- warn!("Connection {} dropped", endpoint);
+ warn!("Connection {:?} dropped", endpoint);
}
// Close the connection channel when the connection dropped
chan.close();