[#2605] Use SO_REUSEADDR on EpollServerSocketChannel to match defaults of java.nio.ServerSocketChannel impl
Motivation: When using openjdk and oracle jdk's nio (while using the nio transport) the ServerSocketChannel uses SO_REUSEADDR by default. Our native transport should do the same to make it easier to switch between the different implementations and get the expected result. Modification: Change EpollServerSocketChannelConfig to set SO_REUSEADDR on the created socket. Result: SO_REUSEADDR is used by default on servers.
This commit is contained in:
parent
d2e385acc2
commit
b0e5c9be00
@ -38,6 +38,11 @@ public final class EpollServerSocketChannelConfig extends DefaultChannelConfig
|
|||||||
EpollServerSocketChannelConfig(EpollServerSocketChannel channel) {
|
EpollServerSocketChannelConfig(EpollServerSocketChannel channel) {
|
||||||
super(channel);
|
super(channel);
|
||||||
this.channel = channel;
|
this.channel = channel;
|
||||||
|
|
||||||
|
// Use SO_REUSEADDR by default as java.nio does the same.
|
||||||
|
//
|
||||||
|
// See https://github.com/netty/netty/issues/2605
|
||||||
|
setReuseAddress(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user