[#2359] EpollSocketChannel.remoteAddress0() is always null on accepted EpollSocketChannels
Motivation: EpollSocketChannel.remoteAddress0() is always null on accepted EpollSocketChannels as we not set it excplicit. Modifications: Correctly retrieve the local and remote address when accept new channel and store it Result: EpollSocketchannel.remoteAddress0() and EpollSocketChannel.localAddress0() return correct addresses
This commit is contained in:
parent
fdb1db90c4
commit
791c38befe
@ -66,9 +66,13 @@ public final class EpollSocketChannel extends AbstractEpollChannel implements So
|
|||||||
private volatile boolean inputShutdown;
|
private volatile boolean inputShutdown;
|
||||||
private volatile boolean outputShutdown;
|
private volatile boolean outputShutdown;
|
||||||
|
|
||||||
EpollSocketChannel(Channel parent, int fd) {
|
EpollSocketChannel(Channel parent, int fd) throws IOException {
|
||||||
super(parent, fd, Native.EPOLLIN, true);
|
super(parent, fd, Native.EPOLLIN, true);
|
||||||
config = new EpollSocketChannelConfig(this);
|
config = new EpollSocketChannelConfig(this);
|
||||||
|
// Directly cache the remote and local addresses
|
||||||
|
// See https://github.com/netty/netty/issues/2359
|
||||||
|
remote = Native.remoteAddress(fd);
|
||||||
|
local = Native.localAddress(fd);
|
||||||
}
|
}
|
||||||
|
|
||||||
public EpollSocketChannel() {
|
public EpollSocketChannel() {
|
||||||
|
Loading…
Reference in New Issue
Block a user