aboutsummaryrefslogtreecommitdiff
path: root/src/netapp.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/netapp.rs')
-rw-r--r--src/netapp.rs16
1 files changed, 10 insertions, 6 deletions
diff --git a/src/netapp.rs b/src/netapp.rs
index 1ac5f37..e9efa2e 100644
--- a/src/netapp.rs
+++ b/src/netapp.rs
@@ -307,7 +307,7 @@ impl NetApp {
if let Some(c) = conn {
debug!(
"Closing connection to {} ({})",
- hex::encode(c.peer_id),
+ hex::encode(&c.peer_id[..8]),
c.remote_addr
);
c.close();
@@ -334,7 +334,11 @@ impl NetApp {
// has an actual IP address and port we can call them back on.
// We will know this when they send a Hello message, which is handled below.
pub(crate) fn connected_as_server(&self, id: NodeID, conn: Arc<ServerConn>) {
- info!("Accepted connection from {}", hex::encode(id));
+ info!(
+ "Accepted connection from {} at {}",
+ hex::encode(&id[..8]),
+ conn.remote_addr
+ );
self.server_conns.write().unwrap().insert(id, conn);
}
@@ -349,7 +353,7 @@ impl NetApp {
// We deregister the connection from server_conns and call the
// handler registered by on_disconnected
pub(crate) fn disconnected_as_server(&self, id: &NodeID, conn: Arc<ServerConn>) {
- info!("Connection from {} closed", hex::encode(id));
+ info!("Connection from {} closed", hex::encode(&id[..8]));
let mut conn_list = self.server_conns.write().unwrap();
if let Some(c) = conn_list.get(id) {
@@ -372,7 +376,7 @@ impl NetApp {
// they know on which port to call us back. (TODO: don't do this if we are
// just a simple client and not a full p2p node)
pub(crate) fn connected_as_client(&self, id: NodeID, conn: Arc<ClientConn>) {
- info!("Connection established to {}", hex::encode(id));
+ info!("Connection established to {}", hex::encode(&id[..8]));
{
let old_c_opt = self.client_conns.write().unwrap().insert(id, conn.clone());
@@ -409,7 +413,7 @@ impl NetApp {
// The connection is removed from conn_list, and the on_disconnected handler
// is called.
pub(crate) fn disconnected_as_client(&self, id: &NodeID, conn: Arc<ClientConn>) {
- info!("Connection to {} closed", hex::encode(id));
+ info!("Connection to {} closed", hex::encode(&id[..8]));
let mut conn_list = self.client_conns.write().unwrap();
if let Some(c) = conn_list.get(id) {
if Arc::ptr_eq(c, &conn) {
@@ -429,7 +433,7 @@ impl NetApp {
#[async_trait]
impl EndpointHandler<HelloMessage> for NetApp {
async fn handle(self: &Arc<Self>, msg: &HelloMessage, from: NodeID) {
- debug!("Hello from {:?}: {:?}", hex::encode(from), msg);
+ debug!("Hello from {:?}: {:?}", hex::encode(&from[..8]), msg);
if let Some(h) = self.on_connected_handler.load().as_ref() {
if let Some(c) = self.server_conns.read().unwrap().get(&from) {
let remote_ip = msg.server_addr.unwrap_or_else(|| c.remote_addr.ip());