[#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
05333862ba
commit
6880e27ce9
@ -181,13 +181,17 @@ public final class EpollSocketChannel extends AbstractEpollStreamChannel impleme
|
||||
checkResolvable((InetSocketAddress) localAddress);
|
||||
}
|
||||
checkResolvable((InetSocketAddress) remoteAddress);
|
||||
if (super.doConnect(remoteAddress, localAddress)) {
|
||||
int fd = fd().intValue();
|
||||
local = Native.localAddress(fd);
|
||||
boolean connected = super.doConnect(remoteAddress, localAddress);
|
||||
if (connected) {
|
||||
remote = (InetSocketAddress) remoteAddress;
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user