Small simplification in TcpConnection
This commit is contained in:
parent
1790bc0e1a
commit
c43ce95bd4
1 changed files with 2 additions and 9 deletions
|
|
@ -51,7 +51,7 @@ private[io] abstract class TcpConnection(val channel: SocketChannel,
|
||||||
context.become(connected(handler))
|
context.become(connected(handler))
|
||||||
|
|
||||||
case cmd: CloseCommand ⇒
|
case cmd: CloseCommand ⇒
|
||||||
handleClose(commander, Some(sender), closeResponse(cmd))
|
handleClose(commander, Some(sender), cmd.event)
|
||||||
|
|
||||||
case ReceiveTimeout ⇒
|
case ReceiveTimeout ⇒
|
||||||
// after sending `Register` user should watch this actor to make sure
|
// after sending `Register` user should watch this actor to make sure
|
||||||
|
|
@ -80,7 +80,7 @@ private[io] abstract class TcpConnection(val channel: SocketChannel,
|
||||||
|
|
||||||
case ChannelWritable ⇒ if (writePending) doWrite(handler)
|
case ChannelWritable ⇒ if (writePending) doWrite(handler)
|
||||||
|
|
||||||
case cmd: CloseCommand ⇒ handleClose(handler, Some(sender), closeResponse(cmd))
|
case cmd: CloseCommand ⇒ handleClose(handler, Some(sender), cmd.event)
|
||||||
}
|
}
|
||||||
|
|
||||||
/** connection is closing but a write has to be finished first */
|
/** connection is closing but a write has to be finished first */
|
||||||
|
|
@ -225,13 +225,6 @@ private[io] abstract class TcpConnection(val channel: SocketChannel,
|
||||||
context.stop(self)
|
context.stop(self)
|
||||||
}
|
}
|
||||||
|
|
||||||
def closeResponse(closeCommand: CloseCommand): ConnectionClosed =
|
|
||||||
closeCommand match {
|
|
||||||
case Close ⇒ Closed
|
|
||||||
case Abort ⇒ Aborted
|
|
||||||
case ConfirmedClose ⇒ ConfirmedClosed
|
|
||||||
}
|
|
||||||
|
|
||||||
def handleError(handler: ActorRef, exception: IOException): Unit = {
|
def handleError(handler: ActorRef, exception: IOException): Unit = {
|
||||||
closedMessage = CloseInformation(Set(handler), ErrorClosed(extractMsg(exception)))
|
closedMessage = CloseInformation(Set(handler), ErrorClosed(extractMsg(exception)))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue