From 83d75528ee0817eee8448264105915819574a91d Mon Sep 17 00:00:00 2001 From: Patrik Nordwall Date: Fri, 23 Jan 2015 15:12:13 +0100 Subject: [PATCH] =act #16653 swallow exception from setTcpNoDelay * some versions of netcat (`nc -z`) doesn't allow setTcpNoDelay (cherry picked from commit c4ca93eec652c31f48b7203999dc8b27c3ebc70a) Conflicts: akka-actor/src/main/scala/akka/io/TcpConnection.scala --- akka-actor/src/main/scala/akka/io/TcpConnection.scala | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/akka-actor/src/main/scala/akka/io/TcpConnection.scala b/akka-actor/src/main/scala/akka/io/TcpConnection.scala index e46d3ccc54..7d64f77db0 100644 --- a/akka-actor/src/main/scala/akka/io/TcpConnection.scala +++ b/akka-actor/src/main/scala/akka/io/TcpConnection.scala @@ -181,7 +181,12 @@ private[io] abstract class TcpConnection(val tcp: TcpExt, val channel: SocketCha def completeConnect(registration: ChannelRegistration, commander: ActorRef, options: immutable.Traversable[SocketOption]): Unit = { // Turn off Nagle's algorithm by default - channel.socket.setTcpNoDelay(true) + try channel.socket.setTcpNoDelay(true) catch { + case e: SocketException ⇒ + // as reported in #16653 some versions of netcat (`nc -z`) doesn't allow setTcpNoDelay + // continue anyway + log.debug("Could not enable TcpNoDelay: {}", e.getMessage) + } options.foreach(_.afterConnect(channel)) commander ! Connected(