=tcp #15766: Workaround for Windows to detect TCP abort

(cherry picked from commit 9340215)
This commit is contained in:
Endre Sándor Varga 2014-09-15 11:19:07 +02:00
parent fe1718c88f
commit 3a2f4e14d4
5 changed files with 158 additions and 6 deletions

View file

@ -55,6 +55,7 @@ private[io] abstract class TcpConnection(val tcp: TcpExt, val channel: SocketCha
if (TraceLogging) log.debug("[{}] registered as connection handler", handler)
val info = ConnectionInfo(registration, handler, keepOpenOnPeerClosed, useResumeWriting)
// if we have resumed reading from pullMode while waiting for Register then register OP_READ interest
if (pullMode && !readingSuspended) resumeReading(info)
doRead(info, None) // immediately try reading, pullMode is handled by readingSuspended
@ -186,6 +187,10 @@ private[io] abstract class TcpConnection(val tcp: TcpExt, val channel: SocketCha
channel.socket.getLocalSocketAddress.asInstanceOf[InetSocketAddress])
context.setReceiveTimeout(RegisterTimeout)
// !!WARNING!! The line below is needed to make Windows notify us about aborted connections, see #15766
if (WindowsConnectionAbortWorkaroundEnabled) registration.enableInterest(OP_CONNECT)
context.become(waitingForRegistration(registration, commander))
}