=act #15265 Make TcpConnection handle Suspend/ResumeReading while waiting for Register

This commit is contained in:
Björn Antonsson 2014-05-23 11:33:06 +02:00
parent e282ec98c6
commit 40384ae21f

View file

@ -55,10 +55,16 @@ private[io] abstract class TcpConnection(val tcp: TcpExt, val channel: SocketCha
if (TraceLogging) log.debug("[{}] registered as connection handler", handler) if (TraceLogging) log.debug("[{}] registered as connection handler", handler)
val info = ConnectionInfo(registration, handler, keepOpenOnPeerClosed, useResumeWriting) val info = ConnectionInfo(registration, handler, keepOpenOnPeerClosed, useResumeWriting)
if (!pullMode) doRead(info, None) // immediately try reading doRead(info, None) // immediately try reading, pullMode is handled by readingSuspended
context.setReceiveTimeout(Duration.Undefined) context.setReceiveTimeout(Duration.Undefined)
context.become(connected(info)) context.become(connected(info))
case ResumeReading
readingSuspended = false
case SuspendReading
readingSuspended = true
case cmd: CloseCommand case cmd: CloseCommand
val info = ConnectionInfo(registration, commander, keepOpenOnPeerClosed = false, useResumeWriting = false) val info = ConnectionInfo(registration, commander, keepOpenOnPeerClosed = false, useResumeWriting = false)
handleClose(info, Some(sender()), cmd.event) handleClose(info, Some(sender()), cmd.event)