DatagramSessionImpl getLocalAddress doesn't return the local address
--------------------------------------------------------------------

                 Key: DIRMINA-395
                 URL: https://issues.apache.org/jira/browse/DIRMINA-395
             Project: MINA
          Issue Type: Bug
          Components: Transport
    Affects Versions: 1.1.0
         Environment: All OSes
            Reporter: Adam Fisk
             Fix For: 1.1.1


I don't fully understand the comment in the constructor below, but I believe 
it's only relevant for acceptors, not connectors.  In the case of connectors, 
the "serviceAddress" argument below is just the remote host address, which 
should clearly not be set to the local address as it is.

    DatagramSessionImpl( IoService wrapperManager,
                         DatagramService managerDelegate,
                         IoServiceConfig serviceConfig,
                         DatagramChannel ch, IoHandler defaultHandler,
                         SocketAddress serviceAddress )
    {
.....
        // We didn't set the localhost by calling getLocalSocketAddress() to 
avoid
        // the case that getLocalSocketAddress() returns IPv6 address while
        // serviceAddress represents the same address in IPv4.
        this.localAddress = this.serviceAddress = serviceAddress;
....

This is called from DatagramConnectorDelegate in the registerNew method, which 
reads:

            DatagramSessionImpl session = new DatagramSessionImpl(
                wrapper, this,
                req.config,
                req.channel, req.handler,
                req.channel.socket().getRemoteSocketAddress() );

The last argument "req.channel.socket().getRemoteSocketAddress()" should 
clearly not be assigned to the local address.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to