Fix Connectable channel failed to connect assertion error on OS/X

This commit is contained in:
Mathias 2013-04-11 14:28:14 +02:00
parent 913ed46c1a
commit ec13033e5e

View file

@ -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