lib/client.js
function () {
          // don't do it twice
          if (!tcpConnections[msg.tcpId]) return;

          exports.verbose(new Date(), 'Connection closed by remote peer for: ' + addressForLog(msg.address, msg.port));

          newCon.removeAllListeners();
          delete tcpConnections[msg.tcpId];
          send(channel, new MSG.Close(msg.tcpId));
        }
function () {
          // don't do it twice
          if (!tcpConnections[msg.tcpId]) return;

          exports.verbose(new Date(), 'Connection closed by remote peer for: ' + addressForLog(msg.address, msg.port));

          newCon.removeAllListeners();
          delete tcpConnections[msg.tcpId];
          send(channel, new MSG.Close(msg.tcpId));
        }
function ( ) { // don't do it twice if ( ! tcpConnections [ msg . tcpId ] ) return ; exports . verbose ( new Date ( ) , 'Connection closed by remote peer for: ' + addressForLog ( msg . address , msg . port ) ) ; newCon . removeAllListeners ( ) ; delete tcpConnections [ msg . tcpId ] ; send ( channel , new MSG . Close ( msg . tcpId ) ) ; }
add connected listeners for clean up
add connected listeners for clean up