Minor Squad Refactor (#740)

* disassembled SquadService's receive cases into separate methods

* making certain the correct sender reaches the correct functions

* regex

* getting rid of warnings
This commit is contained in:
Fate-JH 2021-04-07 09:40:40 -04:00 committed by GitHub
parent 0124167b7a
commit 430c5d8890
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 1581 additions and 1358 deletions

View file

@ -521,6 +521,10 @@ class MiddlewareActor(
case packet: PlanetSideCryptoPacket =>
log.error(s"Unexpected crypto packet '$packet'")
Behaviors.same
case packet =>
log.error(s"Unexpected type of packet '$packet'")
Behaviors.same
}
}

View file

@ -106,7 +106,8 @@ object PacketCoding {
packet.encode match {
case Successful(payload) =>
packet match {
case _: PlanetSideCryptoPacket => Successful(payload)
case _: PlanetSideCryptoPacket =>
Successful(payload)
case packet: PlanetSideControlPacket =>
ControlPacketOpcode.codec.encode(packet.opcode) match {
case Successful(opcode) => Successful(hex"00".bits ++ opcode ++ payload)
@ -117,6 +118,8 @@ object PacketCoding {
case Successful(opcode) => Successful(opcode ++ payload)
case f @ Failure(_) => f
}
case _ =>
Failure(Err("packet not supported"))
}
case f @ Failure(_) => f
}