2017-03-07 00:30:45 +00:00
|
|
|
// Copyright (c) 2017 PSForever
|
2016-02-05 08:19:13 +00:00
|
|
|
import java.net.InetSocketAddress
|
|
|
|
|
|
2016-04-24 23:06:17 +00:00
|
|
|
import akka.actor._
|
2016-05-02 01:12:42 +00:00
|
|
|
import org.log4s.MDC
|
2016-02-05 08:19:13 +00:00
|
|
|
import scodec.bits._
|
|
|
|
|
|
|
|
|
|
import scala.collection.mutable
|
2016-05-14 03:31:27 +00:00
|
|
|
import akka.actor.SupervisorStrategy.Stop
|
2016-07-31 01:08:40 +00:00
|
|
|
import net.psforever.packet.PacketCoding
|
|
|
|
|
import net.psforever.packet.control.ConnectionClose
|
2020-01-26 01:04:17 +00:00
|
|
|
import net.psforever.WorldConfig
|
2020-01-10 16:13:37 +00:00
|
|
|
import services.ServiceManager
|
|
|
|
|
import services.ServiceManager.Lookup
|
|
|
|
|
import services.account.{IPAddress, StoreIPAddress}
|
2016-02-05 08:19:13 +00:00
|
|
|
|
2016-07-31 01:08:40 +00:00
|
|
|
import scala.concurrent.duration._
|
2016-04-24 23:06:17 +00:00
|
|
|
|
2016-07-31 01:08:40 +00:00
|
|
|
sealed trait SessionRouterAPI
|
|
|
|
|
final case class RawPacket(data : ByteVector) extends SessionRouterAPI
|
|
|
|
|
final case class ResponsePacket(data : ByteVector) extends SessionRouterAPI
|
|
|
|
|
final case class DropSession(id : Long, reason : String) extends SessionRouterAPI
|
|
|
|
|
final case class SessionReaper() extends SessionRouterAPI
|
2016-02-05 08:19:13 +00:00
|
|
|
|
2016-05-18 00:34:21 +00:00
|
|
|
case class SessionPipeline(nameTemplate : String, props : Props)
|
|
|
|
|
|
2016-07-31 01:08:40 +00:00
|
|
|
/**
|
|
|
|
|
* Login sessions are divided between two actors. The crypto session actor transparently handles all of the cryptographic
|
|
|
|
|
* setup of the connection. Once a correct crypto session has been established, all packets, after being decrypted
|
|
|
|
|
* will be passed on to the login session actor. This actor has important state that is used to maintain the login
|
|
|
|
|
* session.
|
|
|
|
|
*
|
|
|
|
|
* > PlanetSide Session Pipeline <
|
|
|
|
|
*
|
|
|
|
|
* read() route decrypt
|
|
|
|
|
* UDP Socket -----> [Session Router] -----> [Crypto Actor] -----> [Session Actor]
|
Persistence (#337)
* constructed service actor to handle persistence of player on server beyond the reaches of WSA from one login to the next; created in PSLogin, interfaced with and updated in WSA
* for what it's worth, players can be completely logged out of the world after 60s of inactivity, alive Infantry only right now; some code was removed from WSA to make it accessible to other classes but it's incomparable to the new code; broke, fixed, compromised on the code that handles loadouts, server login time, etc.
* moved another common vehicle function into global space; persistence object for players in vehicles during log-out or relogging in a vehicle
* support for relogging when dead/released/unfound; silenced implant slot setup during character select screen
* tested and commented code for managing player avatar persistence
* clarificaion of WSA postStop
* test fixed
* postStop change to account for WSA being cut short during initialization
* clarification of SquadService logout
* player died during setup; probably a relog
* kill the doppelganger WSA; die when you are actually dead
* created manifest to assist with vehicle gating; vehicle gating now accomodates the persistence model much better
* fixed the test
* fixed initial vehicle seat access permissions; moved a subscription to AvatarService to support persistence
* bug fixes: safer GridInventory collision checks, plus specific exceptions; SessionRouter waits for the account intermediary before allowing itself to be started; WSA - match error colution, and MAX without arm now creates the arm it expects
* adjusted insertion and removal code to make inventory management less prone to partoial insertions of removals; inventory integrity checking code writen, but no plans on implementing it yet
2020-02-14 15:54:52 +00:00
|
|
|
* /|\ | /|\ | /|\ |
|
2016-07-31 01:08:40 +00:00
|
|
|
* | write() | | encrypt | | response |
|
|
|
|
|
* +--------------+ +-----------+ +-----------------+
|
Persistence (#337)
* constructed service actor to handle persistence of player on server beyond the reaches of WSA from one login to the next; created in PSLogin, interfaced with and updated in WSA
* for what it's worth, players can be completely logged out of the world after 60s of inactivity, alive Infantry only right now; some code was removed from WSA to make it accessible to other classes but it's incomparable to the new code; broke, fixed, compromised on the code that handles loadouts, server login time, etc.
* moved another common vehicle function into global space; persistence object for players in vehicles during log-out or relogging in a vehicle
* support for relogging when dead/released/unfound; silenced implant slot setup during character select screen
* tested and commented code for managing player avatar persistence
* clarificaion of WSA postStop
* test fixed
* postStop change to account for WSA being cut short during initialization
* clarification of SquadService logout
* player died during setup; probably a relog
* kill the doppelganger WSA; die when you are actually dead
* created manifest to assist with vehicle gating; vehicle gating now accomodates the persistence model much better
* fixed the test
* fixed initial vehicle seat access permissions; moved a subscription to AvatarService to support persistence
* bug fixes: safer GridInventory collision checks, plus specific exceptions; SessionRouter waits for the account intermediary before allowing itself to be started; WSA - match error colution, and MAX without arm now creates the arm it expects
* adjusted insertion and removal code to make inventory management less prone to partoial insertions of removals; inventory integrity checking code writen, but no plans on implementing it yet
2020-02-14 15:54:52 +00:00
|
|
|
*/
|
2016-07-31 01:08:40 +00:00
|
|
|
class SessionRouter(role : String, pipeline : List[SessionPipeline]) extends Actor with MDCContextAware {
|
2016-05-19 07:14:38 +00:00
|
|
|
private[this] val log = org.log4s.getLogger(self.path.name)
|
2016-05-01 08:37:36 +00:00
|
|
|
|
2016-07-31 01:08:40 +00:00
|
|
|
import scala.concurrent.ExecutionContext.Implicits.global
|
|
|
|
|
val sessionReaper = context.system.scheduler.schedule(10 seconds, 5 seconds, self, SessionReaper())
|
|
|
|
|
|
2016-04-24 23:06:17 +00:00
|
|
|
val idBySocket = mutable.Map[InetSocketAddress, Long]()
|
2016-07-31 01:08:40 +00:00
|
|
|
val sessionById = mutable.Map[Long, Session]()
|
|
|
|
|
val sessionByActor = mutable.Map[ActorRef, Session]()
|
|
|
|
|
val closePacket = PacketCoding.EncodePacket(ConnectionClose()).require.bytes
|
2020-01-10 16:13:37 +00:00
|
|
|
var accountIntermediary : ActorRef = Actor.noSender
|
2016-04-24 23:06:17 +00:00
|
|
|
|
|
|
|
|
var sessionId = 0L // this is a connection session, not an actual logged in session ID
|
|
|
|
|
var inputRef : ActorRef = ActorRef.noSender
|
|
|
|
|
|
2016-05-14 03:31:27 +00:00
|
|
|
override def supervisorStrategy = OneForOneStrategy() { case _ => Stop }
|
|
|
|
|
|
|
|
|
|
override def preStart = {
|
Persistence (#337)
* constructed service actor to handle persistence of player on server beyond the reaches of WSA from one login to the next; created in PSLogin, interfaced with and updated in WSA
* for what it's worth, players can be completely logged out of the world after 60s of inactivity, alive Infantry only right now; some code was removed from WSA to make it accessible to other classes but it's incomparable to the new code; broke, fixed, compromised on the code that handles loadouts, server login time, etc.
* moved another common vehicle function into global space; persistence object for players in vehicles during log-out or relogging in a vehicle
* support for relogging when dead/released/unfound; silenced implant slot setup during character select screen
* tested and commented code for managing player avatar persistence
* clarificaion of WSA postStop
* test fixed
* postStop change to account for WSA being cut short during initialization
* clarification of SquadService logout
* player died during setup; probably a relog
* kill the doppelganger WSA; die when you are actually dead
* created manifest to assist with vehicle gating; vehicle gating now accomodates the persistence model much better
* fixed the test
* fixed initial vehicle seat access permissions; moved a subscription to AvatarService to support persistence
* bug fixes: safer GridInventory collision checks, plus specific exceptions; SessionRouter waits for the account intermediary before allowing itself to be started; WSA - match error colution, and MAX without arm now creates the arm it expects
* adjusted insertion and removal code to make inventory management less prone to partoial insertions of removals; inventory integrity checking code writen, but no plans on implementing it yet
2020-02-14 15:54:52 +00:00
|
|
|
log.info(s"SessionRouter (for ${role}s) initializing ...")
|
2016-05-14 03:31:27 +00:00
|
|
|
}
|
|
|
|
|
|
2016-04-24 23:06:17 +00:00
|
|
|
def receive = initializing
|
|
|
|
|
|
|
|
|
|
def initializing : Receive = {
|
|
|
|
|
case Hello() =>
|
|
|
|
|
inputRef = sender()
|
2020-01-10 16:13:37 +00:00
|
|
|
ServiceManager.serviceManager ! Lookup("accountIntermediary")
|
Persistence (#337)
* constructed service actor to handle persistence of player on server beyond the reaches of WSA from one login to the next; created in PSLogin, interfaced with and updated in WSA
* for what it's worth, players can be completely logged out of the world after 60s of inactivity, alive Infantry only right now; some code was removed from WSA to make it accessible to other classes but it's incomparable to the new code; broke, fixed, compromised on the code that handles loadouts, server login time, etc.
* moved another common vehicle function into global space; persistence object for players in vehicles during log-out or relogging in a vehicle
* support for relogging when dead/released/unfound; silenced implant slot setup during character select screen
* tested and commented code for managing player avatar persistence
* clarificaion of WSA postStop
* test fixed
* postStop change to account for WSA being cut short during initialization
* clarification of SquadService logout
* player died during setup; probably a relog
* kill the doppelganger WSA; die when you are actually dead
* created manifest to assist with vehicle gating; vehicle gating now accomodates the persistence model much better
* fixed the test
* fixed initial vehicle seat access permissions; moved a subscription to AvatarService to support persistence
* bug fixes: safer GridInventory collision checks, plus specific exceptions; SessionRouter waits for the account intermediary before allowing itself to be started; WSA - match error colution, and MAX without arm now creates the arm it expects
* adjusted insertion and removal code to make inventory management less prone to partoial insertions of removals; inventory integrity checking code writen, but no plans on implementing it yet
2020-02-14 15:54:52 +00:00
|
|
|
case ServiceManager.LookupResult("accountIntermediary", endpoint) =>
|
|
|
|
|
accountIntermediary = endpoint
|
|
|
|
|
log.info(s"SessionRouter starting; ready for $role sessions")
|
|
|
|
|
context.become(started)
|
2016-05-14 03:31:27 +00:00
|
|
|
case default =>
|
Persistence (#337)
* constructed service actor to handle persistence of player on server beyond the reaches of WSA from one login to the next; created in PSLogin, interfaced with and updated in WSA
* for what it's worth, players can be completely logged out of the world after 60s of inactivity, alive Infantry only right now; some code was removed from WSA to make it accessible to other classes but it's incomparable to the new code; broke, fixed, compromised on the code that handles loadouts, server login time, etc.
* moved another common vehicle function into global space; persistence object for players in vehicles during log-out or relogging in a vehicle
* support for relogging when dead/released/unfound; silenced implant slot setup during character select screen
* tested and commented code for managing player avatar persistence
* clarificaion of WSA postStop
* test fixed
* postStop change to account for WSA being cut short during initialization
* clarification of SquadService logout
* player died during setup; probably a relog
* kill the doppelganger WSA; die when you are actually dead
* created manifest to assist with vehicle gating; vehicle gating now accomodates the persistence model much better
* fixed the test
* fixed initial vehicle seat access permissions; moved a subscription to AvatarService to support persistence
* bug fixes: safer GridInventory collision checks, plus specific exceptions; SessionRouter waits for the account intermediary before allowing itself to be started; WSA - match error colution, and MAX without arm now creates the arm it expects
* adjusted insertion and removal code to make inventory management less prone to partoial insertions of removals; inventory integrity checking code writen, but no plans on implementing it yet
2020-02-14 15:54:52 +00:00
|
|
|
log.error(s"Unknown or unexpected message $default before being properly started. Stopping completely...")
|
2016-04-24 23:06:17 +00:00
|
|
|
context.stop(self)
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-31 01:08:40 +00:00
|
|
|
override def postStop() = {
|
|
|
|
|
sessionReaper.cancel()
|
|
|
|
|
}
|
2016-05-02 01:12:42 +00:00
|
|
|
|
2016-07-31 01:08:40 +00:00
|
|
|
def started : Receive = {
|
Persistence (#337)
* constructed service actor to handle persistence of player on server beyond the reaches of WSA from one login to the next; created in PSLogin, interfaced with and updated in WSA
* for what it's worth, players can be completely logged out of the world after 60s of inactivity, alive Infantry only right now; some code was removed from WSA to make it accessible to other classes but it's incomparable to the new code; broke, fixed, compromised on the code that handles loadouts, server login time, etc.
* moved another common vehicle function into global space; persistence object for players in vehicles during log-out or relogging in a vehicle
* support for relogging when dead/released/unfound; silenced implant slot setup during character select screen
* tested and commented code for managing player avatar persistence
* clarificaion of WSA postStop
* test fixed
* postStop change to account for WSA being cut short during initialization
* clarification of SquadService logout
* player died during setup; probably a relog
* kill the doppelganger WSA; die when you are actually dead
* created manifest to assist with vehicle gating; vehicle gating now accomodates the persistence model much better
* fixed the test
* fixed initial vehicle seat access permissions; moved a subscription to AvatarService to support persistence
* bug fixes: safer GridInventory collision checks, plus specific exceptions; SessionRouter waits for the account intermediary before allowing itself to be started; WSA - match error colution, and MAX without arm now creates the arm it expects
* adjusted insertion and removal code to make inventory management less prone to partoial insertions of removals; inventory integrity checking code writen, but no plans on implementing it yet
2020-02-14 15:54:52 +00:00
|
|
|
case _ @ ReceivedPacket(msg, from) =>
|
2016-07-31 01:08:40 +00:00
|
|
|
var session : Session = null
|
2016-05-02 01:12:42 +00:00
|
|
|
|
2016-07-31 01:08:40 +00:00
|
|
|
if(!idBySocket.contains(from)) {
|
|
|
|
|
session = createNewSession(from)
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
val id = idBySocket{from}
|
|
|
|
|
session = sessionById{id}
|
|
|
|
|
}
|
2016-05-02 01:12:42 +00:00
|
|
|
|
2016-07-31 01:08:40 +00:00
|
|
|
if(session.state != Closed()) {
|
|
|
|
|
MDC("sessionId") = session.sessionId.toString
|
Persistence (#337)
* constructed service actor to handle persistence of player on server beyond the reaches of WSA from one login to the next; created in PSLogin, interfaced with and updated in WSA
* for what it's worth, players can be completely logged out of the world after 60s of inactivity, alive Infantry only right now; some code was removed from WSA to make it accessible to other classes but it's incomparable to the new code; broke, fixed, compromised on the code that handles loadouts, server login time, etc.
* moved another common vehicle function into global space; persistence object for players in vehicles during log-out or relogging in a vehicle
* support for relogging when dead/released/unfound; silenced implant slot setup during character select screen
* tested and commented code for managing player avatar persistence
* clarificaion of WSA postStop
* test fixed
* postStop change to account for WSA being cut short during initialization
* clarification of SquadService logout
* player died during setup; probably a relog
* kill the doppelganger WSA; die when you are actually dead
* created manifest to assist with vehicle gating; vehicle gating now accomodates the persistence model much better
* fixed the test
* fixed initial vehicle seat access permissions; moved a subscription to AvatarService to support persistence
* bug fixes: safer GridInventory collision checks, plus specific exceptions; SessionRouter waits for the account intermediary before allowing itself to be started; WSA - match error colution, and MAX without arm now creates the arm it expects
* adjusted insertion and removal code to make inventory management less prone to partoial insertions of removals; inventory integrity checking code writen, but no plans on implementing it yet
2020-02-14 15:54:52 +00:00
|
|
|
log.trace(s"RECV: $msg -> ${session.getPipeline.head.path.name}")
|
2016-07-31 01:08:40 +00:00
|
|
|
session.receive(RawPacket(msg))
|
2016-05-02 01:12:42 +00:00
|
|
|
MDC.clear()
|
2016-02-05 08:19:13 +00:00
|
|
|
}
|
2016-04-24 23:06:17 +00:00
|
|
|
case ResponsePacket(msg) =>
|
2016-05-14 03:31:27 +00:00
|
|
|
val session = sessionByActor.get(sender())
|
2016-07-31 01:08:40 +00:00
|
|
|
|
2016-07-30 21:01:05 +00:00
|
|
|
if(session.isDefined) {
|
2016-07-31 01:08:40 +00:00
|
|
|
if(session.get.state != Closed()) {
|
|
|
|
|
MDC("sessionId") = session.get.sessionId.toString
|
Persistence (#337)
* constructed service actor to handle persistence of player on server beyond the reaches of WSA from one login to the next; created in PSLogin, interfaced with and updated in WSA
* for what it's worth, players can be completely logged out of the world after 60s of inactivity, alive Infantry only right now; some code was removed from WSA to make it accessible to other classes but it's incomparable to the new code; broke, fixed, compromised on the code that handles loadouts, server login time, etc.
* moved another common vehicle function into global space; persistence object for players in vehicles during log-out or relogging in a vehicle
* support for relogging when dead/released/unfound; silenced implant slot setup during character select screen
* tested and commented code for managing player avatar persistence
* clarificaion of WSA postStop
* test fixed
* postStop change to account for WSA being cut short during initialization
* clarification of SquadService logout
* player died during setup; probably a relog
* kill the doppelganger WSA; die when you are actually dead
* created manifest to assist with vehicle gating; vehicle gating now accomodates the persistence model much better
* fixed the test
* fixed initial vehicle seat access permissions; moved a subscription to AvatarService to support persistence
* bug fixes: safer GridInventory collision checks, plus specific exceptions; SessionRouter waits for the account intermediary before allowing itself to be started; WSA - match error colution, and MAX without arm now creates the arm it expects
* adjusted insertion and removal code to make inventory management less prone to partoial insertions of removals; inventory integrity checking code writen, but no plans on implementing it yet
2020-02-14 15:54:52 +00:00
|
|
|
log.trace(s"SEND: $msg -> ${inputRef.path.name}")
|
2016-07-31 01:08:40 +00:00
|
|
|
session.get.send(msg)
|
|
|
|
|
MDC.clear()
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
log.error("Dropped old response packet from actor " + sender().path.name)
|
|
|
|
|
}
|
|
|
|
|
case DropSession(id, reason) =>
|
|
|
|
|
val session = sessionById.get(id)
|
2016-04-24 23:06:17 +00:00
|
|
|
|
2016-07-31 01:08:40 +00:00
|
|
|
if(session.isDefined) {
|
|
|
|
|
removeSessionById(id, reason, graceful = true)
|
2016-07-30 21:01:05 +00:00
|
|
|
} else {
|
2016-07-31 01:08:40 +00:00
|
|
|
log.error(s"Requested to drop non-existent session ID=$id from ${sender()}")
|
|
|
|
|
}
|
|
|
|
|
case SessionReaper() =>
|
2019-12-21 19:18:19 +00:00
|
|
|
val inboundGrace = WorldConfig.Get[Duration]("network.Session.InboundGraceTime").toMillis
|
|
|
|
|
val outboundGrace = WorldConfig.Get[Duration]("network.Session.OutboundGraceTime").toMillis
|
|
|
|
|
|
2016-07-31 01:08:40 +00:00
|
|
|
sessionById.foreach { case (id, session) =>
|
2019-08-21 14:39:44 +00:00
|
|
|
log.trace(session.toString)
|
2016-07-31 01:08:40 +00:00
|
|
|
if(session.getState == Closed()) {
|
|
|
|
|
// clear mappings
|
|
|
|
|
session.getPipeline.foreach(sessionByActor remove)
|
|
|
|
|
sessionById.remove(id)
|
|
|
|
|
idBySocket.remove(session.socketAddress)
|
|
|
|
|
log.debug(s"Reaped session ID=$id")
|
2019-12-21 19:18:19 +00:00
|
|
|
} else if(session.timeSinceLastInboundEvent > inboundGrace) {
|
2016-07-31 01:08:40 +00:00
|
|
|
removeSessionById(id, "session timed out (inbound)", graceful = false)
|
2019-12-21 19:18:19 +00:00
|
|
|
} else if(session.timeSinceLastOutboundEvent > outboundGrace) {
|
2016-07-31 01:08:40 +00:00
|
|
|
removeSessionById(id, "session timed out (outbound)", graceful = true) // tell client to STFU
|
|
|
|
|
}
|
2016-07-30 21:01:05 +00:00
|
|
|
}
|
2016-05-14 03:31:27 +00:00
|
|
|
case Terminated(actor) =>
|
|
|
|
|
val terminatedSession = sessionByActor.get(actor)
|
2016-05-02 01:12:42 +00:00
|
|
|
|
2016-05-14 03:31:27 +00:00
|
|
|
if(terminatedSession.isDefined) {
|
2016-07-31 01:08:40 +00:00
|
|
|
removeSessionById(terminatedSession.get.sessionId, s"${actor.path.name} died",
|
|
|
|
|
graceful = true)
|
2016-07-30 21:01:05 +00:00
|
|
|
} else {
|
|
|
|
|
log.error("Received an invalid actor Termination from " + actor.path.name)
|
2016-05-14 03:31:27 +00:00
|
|
|
}
|
|
|
|
|
case default =>
|
2016-07-30 21:01:05 +00:00
|
|
|
log.error(s"Unknown message $default from " + sender().path)
|
2016-02-05 08:19:13 +00:00
|
|
|
}
|
|
|
|
|
|
2016-04-24 23:06:17 +00:00
|
|
|
def createNewSession(address : InetSocketAddress) = {
|
|
|
|
|
val id = newSessionId
|
2016-07-31 01:08:40 +00:00
|
|
|
val session = new Session(id, address, inputRef, pipeline)
|
2016-04-24 23:06:17 +00:00
|
|
|
|
2016-07-31 01:08:40 +00:00
|
|
|
// establish mappings for easy lookup
|
|
|
|
|
idBySocket{address} = id
|
|
|
|
|
sessionById{id} = session
|
|
|
|
|
|
|
|
|
|
session.getPipeline.foreach { actor =>
|
|
|
|
|
sessionByActor{actor} = session
|
2016-05-18 00:34:21 +00:00
|
|
|
}
|
|
|
|
|
|
Persistence (#337)
* constructed service actor to handle persistence of player on server beyond the reaches of WSA from one login to the next; created in PSLogin, interfaced with and updated in WSA
* for what it's worth, players can be completely logged out of the world after 60s of inactivity, alive Infantry only right now; some code was removed from WSA to make it accessible to other classes but it's incomparable to the new code; broke, fixed, compromised on the code that handles loadouts, server login time, etc.
* moved another common vehicle function into global space; persistence object for players in vehicles during log-out or relogging in a vehicle
* support for relogging when dead/released/unfound; silenced implant slot setup during character select screen
* tested and commented code for managing player avatar persistence
* clarificaion of WSA postStop
* test fixed
* postStop change to account for WSA being cut short during initialization
* clarification of SquadService logout
* player died during setup; probably a relog
* kill the doppelganger WSA; die when you are actually dead
* created manifest to assist with vehicle gating; vehicle gating now accomodates the persistence model much better
* fixed the test
* fixed initial vehicle seat access permissions; moved a subscription to AvatarService to support persistence
* bug fixes: safer GridInventory collision checks, plus specific exceptions; SessionRouter waits for the account intermediary before allowing itself to be started; WSA - match error colution, and MAX without arm now creates the arm it expects
* adjusted insertion and removal code to make inventory management less prone to partoial insertions of removals; inventory integrity checking code writen, but no plans on implementing it yet
2020-02-14 15:54:52 +00:00
|
|
|
log.info(s"New session ID=$id from " + address.toString)
|
2016-07-31 01:08:40 +00:00
|
|
|
|
2020-01-10 16:13:37 +00:00
|
|
|
if(role == "Login") {
|
|
|
|
|
accountIntermediary ! StoreIPAddress(id, new IPAddress(address))
|
|
|
|
|
}
|
|
|
|
|
|
2016-07-31 01:08:40 +00:00
|
|
|
session
|
2016-04-24 23:06:17 +00:00
|
|
|
}
|
|
|
|
|
|
2016-07-31 01:08:40 +00:00
|
|
|
def removeSessionById(id : Long, reason : String, graceful : Boolean) : Unit = {
|
2016-05-14 03:31:27 +00:00
|
|
|
val sessionOption = sessionById.get(id)
|
|
|
|
|
|
2016-07-30 21:01:05 +00:00
|
|
|
if(sessionOption.isEmpty)
|
2016-05-14 03:31:27 +00:00
|
|
|
return
|
|
|
|
|
|
2016-07-31 01:08:40 +00:00
|
|
|
val session : Session = sessionOption.get
|
2016-05-14 03:31:27 +00:00
|
|
|
|
2016-07-31 01:08:40 +00:00
|
|
|
if(graceful) {
|
Persistence (#337)
* constructed service actor to handle persistence of player on server beyond the reaches of WSA from one login to the next; created in PSLogin, interfaced with and updated in WSA
* for what it's worth, players can be completely logged out of the world after 60s of inactivity, alive Infantry only right now; some code was removed from WSA to make it accessible to other classes but it's incomparable to the new code; broke, fixed, compromised on the code that handles loadouts, server login time, etc.
* moved another common vehicle function into global space; persistence object for players in vehicles during log-out or relogging in a vehicle
* support for relogging when dead/released/unfound; silenced implant slot setup during character select screen
* tested and commented code for managing player avatar persistence
* clarificaion of WSA postStop
* test fixed
* postStop change to account for WSA being cut short during initialization
* clarification of SquadService logout
* player died during setup; probably a relog
* kill the doppelganger WSA; die when you are actually dead
* created manifest to assist with vehicle gating; vehicle gating now accomodates the persistence model much better
* fixed the test
* fixed initial vehicle seat access permissions; moved a subscription to AvatarService to support persistence
* bug fixes: safer GridInventory collision checks, plus specific exceptions; SessionRouter waits for the account intermediary before allowing itself to be started; WSA - match error colution, and MAX without arm now creates the arm it expects
* adjusted insertion and removal code to make inventory management less prone to partoial insertions of removals; inventory integrity checking code writen, but no plans on implementing it yet
2020-02-14 15:54:52 +00:00
|
|
|
for(_ <- 0 to 5) {
|
2016-07-31 01:08:40 +00:00
|
|
|
session.send(closePacket)
|
|
|
|
|
}
|
|
|
|
|
}
|
2016-05-14 03:31:27 +00:00
|
|
|
|
2016-07-31 01:08:40 +00:00
|
|
|
// kill all session specific actors
|
|
|
|
|
session.dropSession(graceful)
|
Persistence (#337)
* constructed service actor to handle persistence of player on server beyond the reaches of WSA from one login to the next; created in PSLogin, interfaced with and updated in WSA
* for what it's worth, players can be completely logged out of the world after 60s of inactivity, alive Infantry only right now; some code was removed from WSA to make it accessible to other classes but it's incomparable to the new code; broke, fixed, compromised on the code that handles loadouts, server login time, etc.
* moved another common vehicle function into global space; persistence object for players in vehicles during log-out or relogging in a vehicle
* support for relogging when dead/released/unfound; silenced implant slot setup during character select screen
* tested and commented code for managing player avatar persistence
* clarificaion of WSA postStop
* test fixed
* postStop change to account for WSA being cut short during initialization
* clarification of SquadService logout
* player died during setup; probably a relog
* kill the doppelganger WSA; die when you are actually dead
* created manifest to assist with vehicle gating; vehicle gating now accomodates the persistence model much better
* fixed the test
* fixed initial vehicle seat access permissions; moved a subscription to AvatarService to support persistence
* bug fixes: safer GridInventory collision checks, plus specific exceptions; SessionRouter waits for the account intermediary before allowing itself to be started; WSA - match error colution, and MAX without arm now creates the arm it expects
* adjusted insertion and removal code to make inventory management less prone to partoial insertions of removals; inventory integrity checking code writen, but no plans on implementing it yet
2020-02-14 15:54:52 +00:00
|
|
|
log.info(s"Dropping session ID=$id (reason: $reason)")
|
2016-05-14 03:31:27 +00:00
|
|
|
}
|
|
|
|
|
|
2016-02-05 08:19:13 +00:00
|
|
|
def newSessionId = {
|
|
|
|
|
val oldId = sessionId
|
|
|
|
|
sessionId += 1
|
|
|
|
|
oldId
|
|
|
|
|
}
|
|
|
|
|
}
|