This commit is contained in:
@@ -204,6 +204,7 @@ public abstract class AsyncConnection implements AsynchronousByteChannel, AutoCl
|
|||||||
try {
|
try {
|
||||||
if (noDelay) channel.setOption(StandardSocketOptions.TCP_NODELAY, true);
|
if (noDelay) channel.setOption(StandardSocketOptions.TCP_NODELAY, true);
|
||||||
if (supportTcpKeepAlive()) channel.setOption(StandardSocketOptions.SO_KEEPALIVE, true);
|
if (supportTcpKeepAlive()) channel.setOption(StandardSocketOptions.SO_KEEPALIVE, true);
|
||||||
|
channel.setOption(StandardSocketOptions.SO_REUSEADDR, true);
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
}
|
}
|
||||||
channel.connect(address, null, new CompletionHandler<Void, Void>() {
|
channel.connect(address, null, new CompletionHandler<Void, Void>() {
|
||||||
|
|||||||
@@ -262,6 +262,7 @@ public final class Transport {
|
|||||||
final AsynchronousSocketChannel channel = AsynchronousSocketChannel.open(group);
|
final AsynchronousSocketChannel channel = AsynchronousSocketChannel.open(group);
|
||||||
if (supportTcpNoDelay()) channel.setOption(StandardSocketOptions.TCP_NODELAY, true);
|
if (supportTcpNoDelay()) channel.setOption(StandardSocketOptions.TCP_NODELAY, true);
|
||||||
if (supportTcpKeepAlive()) channel.setOption(StandardSocketOptions.SO_KEEPALIVE, true);
|
if (supportTcpKeepAlive()) channel.setOption(StandardSocketOptions.SO_KEEPALIVE, true);
|
||||||
|
channel.setOption(StandardSocketOptions.SO_REUSEADDR, true);
|
||||||
channel.connect(one.address, one, new CompletionHandler<Void, TransportNode>() {
|
channel.connect(one.address, one, new CompletionHandler<Void, TransportNode>() {
|
||||||
@Override
|
@Override
|
||||||
public void completed(Void result, TransportNode attachment) {
|
public void completed(Void result, TransportNode attachment) {
|
||||||
@@ -312,6 +313,8 @@ public final class Transport {
|
|||||||
if (future.isDone()) return future;
|
if (future.isDone()) return future;
|
||||||
final AsynchronousSocketChannel channel = AsynchronousSocketChannel.open(group);
|
final AsynchronousSocketChannel channel = AsynchronousSocketChannel.open(group);
|
||||||
if (supportTcpNoDelay()) channel.setOption(StandardSocketOptions.TCP_NODELAY, true);
|
if (supportTcpNoDelay()) channel.setOption(StandardSocketOptions.TCP_NODELAY, true);
|
||||||
|
if (supportTcpKeepAlive()) channel.setOption(StandardSocketOptions.SO_KEEPALIVE, true);
|
||||||
|
channel.setOption(StandardSocketOptions.SO_REUSEADDR, true);
|
||||||
channel.connect(node.address, node, new CompletionHandler<Void, TransportNode>() {
|
channel.connect(node.address, node, new CompletionHandler<Void, TransportNode>() {
|
||||||
@Override
|
@Override
|
||||||
public void completed(Void result, TransportNode attachment) {
|
public void completed(Void result, TransportNode attachment) {
|
||||||
|
|||||||
Reference in New Issue
Block a user