Skip to content
Permalink
Browse files

Log incoming connection's peer address

Use a key-value pair to log the peer address when
reporting connection errors.
  • Loading branch information...
mzabaluev committed Sep 11, 2019
1 parent 41389d2 commit 20895a994305f562b783326b4495b44965b9e0e1
Showing with 4 additions and 4 deletions.
  1. +4 −4 jormungandr/src/network/grpc/server.rs
@@ -41,15 +41,15 @@ pub fn run_listen_socket(
})
.fold(server, move |mut server, stream| {
// received incoming connection
let conn_logger =
fold_logger.new(o!("peer_addr" => stream.peer_addr().unwrap()));
info!(
fold_logger,
"{} connected to {}",
stream.peer_addr().unwrap(),
conn_logger,
"incoming P2P connection on {}",
stream.local_addr().unwrap(),
);

let conn = server.serve(stream);
let conn_logger = fold_logger.clone();
tokio::spawn(conn.map_err(move |e| {
warn!(conn_logger, "incoming P2P connection error: {:?}", e)
}));

0 comments on commit 20895a9

Please sign in to comment.
You can’t perform that action at this time.