From 5d78918fb2b21b8d0a4cd83ada5560f2687b3797 Mon Sep 17 00:00:00 2001 From: Ivan Vilata-i-Balaguer Date: Mon, 11 Apr 2016 11:08:08 +0200 Subject: [PATCH] Extend comment on the role of `Connection.InputHandler` --- .../java/io/bitsquare/p2p/network/Connection.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/network/src/main/java/io/bitsquare/p2p/network/Connection.java b/network/src/main/java/io/bitsquare/p2p/network/Connection.java index 2e91683cf5..de9e11bd0c 100644 --- a/network/src/main/java/io/bitsquare/p2p/network/Connection.java +++ b/network/src/main/java/io/bitsquare/p2p/network/Connection.java @@ -585,7 +585,9 @@ public class Connection implements MessageListener { // InputHandler /////////////////////////////////////////////////////////////////////////////////////////// - // Runs in same thread as Connection + // Runs in same thread as Connection, receives a message, performs several checks on it + // (including throttling limits, validity and statistics) + // and delivers it to the message listener given in the constructor. private static class InputHandler implements Runnable { private static final Logger log = LoggerFactory.getLogger(InputHandler.class); @@ -730,13 +732,13 @@ public class Connection implements MessageListener { if (!(message instanceof KeepAliveMessage)) connection.statistic.updateLastActivityTimestamp(); - // First a seed node gets a message form a peer (PreliminaryDataRequest using - // AnonymousMessage interface) which does not has its hidden service - // published, so does not know its address. As the IncomingConnection does not has the + // First a seed node gets a message from a peer (PreliminaryDataRequest using + // AnonymousMessage interface) which does not have its hidden service + // published, so it does not know its address. As the IncomingConnection does not have the // peersNodeAddress set that connection cannot be used for outgoing messages until we // get the address set. // At the data update message (DataRequest using SendersNodeAddressMessage interface) - // after the HS is published we get the peers address set. + // after the HS is published we get the peer's address set. // There are only those messages used for new connections to a peer: // 1. PreliminaryDataRequest