[#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
db5285950b
commit
d31b60ceaa
@ -69,6 +69,10 @@ public final class EpollSocketChannel extends AbstractEpollChannel implements So
|
||||
EpollSocketChannel(Channel parent, EventLoop eventLoop, int fd) {
|
||||
super(parent, eventLoop, fd, Native.EPOLLIN, true);
|
||||
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(EventLoop eventLoop) {
|
||||
|
Loading…
Reference in New Issue
Block a user