On Mon, Jul 23, 2012 at 9:24 AM, Emmanuel Lécharny <[email protected]> wrote:
> Le 7/23/12 9:08 AM, Julien Vermillard a écrit :
>
>> On Sun, Jul 22, 2012 at 10:21 PM, Emmanuel Lécharny <[email protected]>
>> wrote:
>>>
>>> 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 ?
>>>
>> The accept event will be queued at the kernel level, and will be
>> processed by the first select,
>
>
> Is this guaranteed ?
>
For posix : http://linux.die.net/man/2/listen

For windows I suppose it's the same

Reply via email to