mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-04-24 13:25:23 +00:00
Increase SessionReaper timeouts and add to config file
This should fix issues disconnecting at loading screens/zone changes as no packets are being transmitted during this window. If the WorldSessionsActor is also slightly overloaded, the session reaper can drop the session mistakenly due to no outbound traffic. Also fix-up WorldConfig.Get with better error messages along with more tests.
This commit is contained in:
parent
d2732550e8
commit
83ac66a3bf
5 changed files with 82 additions and 3 deletions
|
|
@ -111,6 +111,9 @@ class SessionRouter(role : String, pipeline : List[SessionPipeline]) extends Act
|
|||
log.error(s"Requested to drop non-existent session ID=$id from ${sender()}")
|
||||
}
|
||||
case SessionReaper() =>
|
||||
val inboundGrace = WorldConfig.Get[Duration]("network.Session.InboundGraceTime").toMillis
|
||||
val outboundGrace = WorldConfig.Get[Duration]("network.Session.OutboundGraceTime").toMillis
|
||||
|
||||
sessionById.foreach { case (id, session) =>
|
||||
log.trace(session.toString)
|
||||
if(session.getState == Closed()) {
|
||||
|
|
@ -119,9 +122,9 @@ class SessionRouter(role : String, pipeline : List[SessionPipeline]) extends Act
|
|||
sessionById.remove(id)
|
||||
idBySocket.remove(session.socketAddress)
|
||||
log.debug(s"Reaped session ID=$id")
|
||||
} else if(session.timeSinceLastInboundEvent > 10000) {
|
||||
} else if(session.timeSinceLastInboundEvent > inboundGrace) {
|
||||
removeSessionById(id, "session timed out (inbound)", graceful = false)
|
||||
} else if(session.timeSinceLastOutboundEvent > 4000) {
|
||||
} else if(session.timeSinceLastOutboundEvent > outboundGrace) {
|
||||
removeSessionById(id, "session timed out (outbound)", graceful = true) // tell client to STFU
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12,6 +12,10 @@ object WorldConfig extends ConfigParser {
|
|||
ConfigSection("worldserver",
|
||||
ConfigEntryInt("ListeningPort", 51001, Constraints.min(1), Constraints.max(65535))
|
||||
),
|
||||
ConfigSection("network",
|
||||
ConfigEntryTime("Session.InboundGraceTime", 1 minute, Constraints.min(10 seconds)),
|
||||
ConfigEntryTime("Session.OutboundGraceTime", 1 minute, Constraints.min(10 seconds))
|
||||
),
|
||||
ConfigSection("developer",
|
||||
ConfigEntryBool ("NetSim.Active", false),
|
||||
ConfigEntryFloat("NetSim.Loss", 0.02f, Constraints.min(0.0f), Constraints.max(1.0f)),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue