make history actor a child of the round socket actor
This commit is contained in:
parent
48885664b4
commit
72ddcede22
|
@ -16,12 +16,14 @@ import makeTimeout.short
|
|||
|
||||
private[round] final class Socket(
|
||||
gameId: String,
|
||||
history: ActorRef,
|
||||
makeHistory: () ⇒ History,
|
||||
getUsername: String ⇒ Fu[Option[String]],
|
||||
uidTimeout: Duration,
|
||||
socketTimeout: Duration,
|
||||
playerTimeout: Duration) extends SocketActor[Member](uidTimeout) {
|
||||
|
||||
private val history = context.actorOf(Props(makeHistory()), name = "history")
|
||||
|
||||
private var lastPingTime = nowMillis
|
||||
|
||||
// when the players have been seen online for the last time
|
||||
|
@ -98,7 +100,7 @@ private[round] final class Socket(
|
|||
white = ownerOf(White).isDefined,
|
||||
black = ownerOf(Black).isDefined,
|
||||
watchers = showSpectators(userList.flatten, anons.size)
|
||||
) :: Nil)
|
||||
) :: Nil)
|
||||
} logFailure ("[round] notify crowd")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,21 +21,18 @@ private[round] final class SocketHub(
|
|||
|
||||
def receiveSpecific = {
|
||||
|
||||
case msg @ IsConnectedOnGame(gameId, color) ⇒ (sockets get gameId).fold(sender ! false) {
|
||||
case msg @ IsConnectedOnGame(gameId, _) ⇒ (sockets get gameId).fold(sender ! false) {
|
||||
_ ? msg pipeTo sender
|
||||
}
|
||||
|
||||
case msg @ IsGone(gameId, color) ⇒ (sockets get gameId).fold(sender ! false) {
|
||||
case msg @ IsGone(gameId, _) ⇒ (sockets get gameId).fold(sender ! false) {
|
||||
_ ? msg pipeTo sender
|
||||
}
|
||||
}
|
||||
|
||||
def mkSocket(id: String): ActorRef = context.actorOf(Props(new Socket(
|
||||
gameId = id,
|
||||
history = context.actorOf(
|
||||
Props(makeHistory()),
|
||||
name = id + "-history"
|
||||
),
|
||||
makeHistory = makeHistory,
|
||||
getUsername = getUsername,
|
||||
uidTimeout = uidTimeout,
|
||||
socketTimeout = socketTimeout,
|
||||
|
|
Loading…
Reference in a new issue