[
https://issues.apache.org/jira/browse/DIRMINA-395?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Adam Fisk updated DIRMINA-395:
------------------------------
Attachment: datagramLocalHostConnectorPath.patch
Simple patch to fix the issue for datagram connectors. The behavior for
acceptors is unchanged.
The fix basically just adds an arguments to the DatagramSessionImpl constructor
for the local address. When acceptors are constructed, they pass the service
address for the local address, effectively just like the prior code. With
connectors, though, they pass the local address.
There can't be a IPv4 versus IPv6 conflict in that case because the connector
constructor calls:
req.channel.socket().getRemoteSocketAddress()
for the service address and:
req.channel.socket().getLocalSocketAddress()
for the local address. Those calls have to both return the same address type.
I also moved the comment about address type conflicts into the
DatagramAcceptorDelegate, as that's where it's more relevant.
> 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
>
> Attachments: datagramLocalHostConnectorPath.patch
>
>
> 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.