Hi,

while checking the Mina 3 code, I saw that the NioTcpServer bind() method might potentially leads to losing some events, if I'm not wrong.

The bind() method does this :

public synchronized void bind(final SocketAddress localAddress) throws IOException { serverChannel = ServerSocketChannel.open(); <<---------- here, the channel is not ready to accept incoming requests
        ...
serverChannel.socket().bind(address); <<---- !!! Now, the server can receive incoming connections
        serverChannel.configureBlocking(false);

        acceptProcessor = this.strategy.getSelectorForBindNewAddress();

acceptProcessor.addServer(this); <<--- We then create the selector here

So we can open a serveur socket, but we are not ready yet to process the requests...Woudln't it make more sense to let the acceptProcessor do the bind ?

--
Regards,
Cordialement,
Emmanuel Lécharny
www.iktek.com

Reply via email to