@ Override public void notifyOfConnection ( int hostId , SocketChannel socket , SSLEngine sslEngine , InetSocketAddress listeningAddress ) throws Exception { networkLog . info ( "Host " + getHostId ( ) + " receives a new connection from host " + hostId ) ; prepSocketChannel ( socket ) ; // Auxiliary connection never time out ForeignHost fhost = new ForeignHost ( this , hostId , socket , Integer . MAX_VALUE , listeningAddress , createPicoNetwork ( sslEngine , socket , true ) ) ; putForeignHost ( hostId , fhost ) ; fhost . enableRead ( VERBOTEN_THREADS ) ; // Do all peers have enough secondary connections? for ( int hId : m_peers ) { if ( m_foreignHosts . get ( hId ) . size ( ) != ( m_secondaryConnections + 1 ) ) { return ; } } // Now it's time to use secondary pico network, see comments in presend() to know why we can't // do this earlier. m_hasAllSecondaryConnectionCreated = true ; }
SocketJoiner receives the request of creating a new connection from given host id create a new ForeignHost for this connection .