From ec13033e5e630ee706cd45f1f7b4f6f549ccb1d6 Mon Sep 17 00:00:00 2001 From: Mathias Date: Thu, 11 Apr 2013 14:28:14 +0200 Subject: [PATCH] Fix `Connectable channel failed to connect` assertion error on OS/X --- akka-actor/src/main/scala/akka/io/TcpConnection.scala | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/akka-actor/src/main/scala/akka/io/TcpConnection.scala b/akka-actor/src/main/scala/akka/io/TcpConnection.scala index 5f4b42e701..9e5629adbb 100644 --- a/akka-actor/src/main/scala/akka/io/TcpConnection.scala +++ b/akka-actor/src/main/scala/akka/io/TcpConnection.scala @@ -33,7 +33,8 @@ private[io] abstract class TcpConnection(val channel: SocketChannel, // Needed to send the ConnectionClosed message in the postStop handler. var closedMessage: CloseInformation = null - var keepOpenOnPeerClosed: Boolean = false + private[this] var peerClosed = false + private[this] var keepOpenOnPeerClosed = false def writePending = pendingWrite ne null @@ -211,7 +212,7 @@ private[io] abstract class TcpConnection(val channel: SocketChannel, // report that peer closed the connection handler ! PeerClosed // used to check if peer already closed its side later - channel.socket().shutdownInput() + peerClosed = true context.become(peerSentEOF(handler)) case _ if writePending ⇒ // finish writing first if (TraceLogging) log.debug("Got Close command but write is still pending.") @@ -220,7 +221,7 @@ private[io] abstract class TcpConnection(val channel: SocketChannel, if (TraceLogging) log.debug("Got ConfirmedClose command, sending FIN.") channel.socket.shutdownOutput() - if (channel.socket().isInputShutdown) // if peer closed first, the socket is now fully closed + if (peerClosed) // if peer closed first, the socket is now fully closed doCloseConnection(handler, closeCommander, closedEvent) else context.become(closing(handler, closeCommander)) case _ ⇒ // close now