private SocketChannel accept ( ) throws IOException { // The situation where connection cannot be accepted due to insufficient // resources is considered valid and treated by ignoring the connection. // Accept one connection and deal with different failure modes. assert ( fd != null ) ; SocketChannel sock = fd . accept ( ) ; if ( ! options . tcpAcceptFilters . isEmpty ( ) ) { boolean matched = false ; for ( TcpAddress . TcpAddressMask am : options . tcpAcceptFilters ) { if ( am . matchAddress ( address . address ( ) ) ) { matched = true ; break ; } } if ( ! matched ) { try { sock . close ( ) ; } catch ( IOException e ) { } return null ; } } if ( options . tos != 0 ) { TcpUtils . setIpTypeOfService ( sock , options . tos ) ; } // Set the socket buffer limits for the underlying socket. if ( options . sndbuf != 0 ) { TcpUtils . setTcpSendBuffer ( sock , options . sndbuf ) ; } if ( options . rcvbuf != 0 ) { TcpUtils . setTcpReceiveBuffer ( sock , options . rcvbuf ) ; } if ( ! isWindows ) { TcpUtils . setReuseAddress ( sock , true ) ; } return sock ; }
or was denied because of accept filters .