[#3463] EpollSocketChannel.localAddress() returns always null if Native.connect() was not able to connect directly
Motivation: Due a a regression that was introduced by b898bdd we failed to set the localAddress if the connect did not success directly. Modifications: Correct set localAddress in doConnect(...) Result: Be able to get the localAddress in all cases.
This commit is contained in:
parent
6d5c38897e
commit
1a83232ab2
@ -181,13 +181,17 @@ public final class EpollSocketChannel extends AbstractEpollStreamChannel impleme
|
|||||||
checkResolvable((InetSocketAddress) localAddress);
|
checkResolvable((InetSocketAddress) localAddress);
|
||||||
}
|
}
|
||||||
checkResolvable((InetSocketAddress) remoteAddress);
|
checkResolvable((InetSocketAddress) remoteAddress);
|
||||||
if (super.doConnect(remoteAddress, localAddress)) {
|
|
||||||
int fd = fd().intValue();
|
int fd = fd().intValue();
|
||||||
local = Native.localAddress(fd);
|
boolean connected = super.doConnect(remoteAddress, localAddress);
|
||||||
|
if (connected) {
|
||||||
remote = (InetSocketAddress) remoteAddress;
|
remote = (InetSocketAddress) remoteAddress;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
// We always need to set the localAddress even if not connected yet
|
||||||
|
//
|
||||||
|
// See https://github.com/netty/netty/issues/3463
|
||||||
|
local = Native.localAddress(fd);
|
||||||
|
return connected;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final class EpollSocketChannelUnsafe extends EpollStreamUnsafe {
|
private final class EpollSocketChannelUnsafe extends EpollStreamUnsafe {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user