protected boolean isConnectionOk ( IoSession session ) { SocketAddress remoteAddress = session . getRemoteAddress ( ) ; if ( remoteAddress instanceof InetSocketAddress ) { InetSocketAddress addr = ( InetSocketAddress ) remoteAddress ; long now = System . currentTimeMillis ( ) ; if ( clients . containsKey ( addr . getAddress ( ) . getHostAddress ( ) ) ) { LOGGER . debug ( "This is not a new client" ) ; Long lastConnTime = clients . get ( addr . getAddress ( ) . getHostAddress ( ) ) ; clients . put ( addr . getAddress ( ) . getHostAddress ( ) , now ) ; // if the interval between now and the last connection is // less than the allowed interval, return false if ( now - lastConnTime < allowedInterval ) { LOGGER . warn ( "Session connection interval too short" ) ; return false ; } return true ; } clients . put ( addr . getAddress ( ) . getHostAddress ( ) , now ) ; return true ; } return false ; }
Method responsible for deciding if a connection is OK to continue