mina-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Celio Cidral" <ce...@kidux.net>
Subject IoAcceptor does not unbind address 0.0.0.0
Date Fri, 09 Jan 2009 13:12:09 GMT
I'm not sure whether this is an issue or not.  We have experienced that the
NioSocketAcceptor does not unbind the 0.0.0.0 address.  When you
bind(0.0.0.0), the NioSocketAcceptor gets a SocketAddress from the
ServerSocketChannel containing a slightly different address:

NioSocketAcceptor.java:
    protected SocketAddress localAddress(ServerSocketChannel handle)
            throws Exception {
        return handle.socket().getLocalSocketAddress();
    }


The address returned by handle.socket().getLocalSocketAddress() is
"0.0.0.0.0.0.0.0/<port>".  Then the acceptor keeps that address and when you
try to unbind() "0.0.0.0/<port>", it does not find the address and does not
unbind it.  Our workaround is to call unbind() without any parameters, so
that it effectivelly unbind all local addresses.

I've attached a patch (against MINA-2.0 M4) containing a unit test for this
use case.

Best regards,

CĂ©lio

Mime
View raw message