mirror of
https://github.com/2revoemag/PSF-BotServer.git
synced 2026-02-14 04:03:36 +00:00
Create advance session management and reaping
This commit is contained in:
parent
c1257cb1ec
commit
ae6687c38f
10 changed files with 301 additions and 84 deletions
|
|
@ -17,7 +17,7 @@ object ControlPacketOpcode extends Enumeration {
|
|||
ServerStart, // second packet sent in response to ClientStart
|
||||
MultiPacket, // used to send multiple packets with one UDP message (subpackets limited to <= 255)
|
||||
Unknown4,
|
||||
Unknown5,
|
||||
TeardownConnection,
|
||||
Unknown6,
|
||||
ControlSync, // sent to the server from the client
|
||||
ControlSyncResp, // the response generated by the server
|
||||
|
|
@ -61,7 +61,7 @@ object ControlPacketOpcode extends Enumeration {
|
|||
case ClientStart => control.ClientStart.decode
|
||||
case MultiPacket => control.MultiPacket.decode
|
||||
case Unknown4 => noDecoder(opcode)
|
||||
case Unknown5 => noDecoder(opcode)
|
||||
case TeardownConnection => control.TeardownConnection.decode
|
||||
case Unknown6 => noDecoder(opcode)
|
||||
case ControlSync => control.ControlSync.decode
|
||||
case ControlSyncResp => control.ControlSyncResp.decode
|
||||
|
|
|
|||
|
|
@ -0,0 +1,19 @@
|
|||
// Copyright (c) 2016 PSForever.net to present
|
||||
package net.psforever.packet.control
|
||||
|
||||
import net.psforever.packet.{ControlPacketOpcode, Marshallable, PacketHelpers, PlanetSideControlPacket}
|
||||
import scodec.Codec
|
||||
import scodec.codecs._
|
||||
|
||||
final case class TeardownConnection(targetNonce : Long) extends PlanetSideControlPacket {
|
||||
type Packet = TeardownConnection
|
||||
def opcode = ControlPacketOpcode.TeardownConnection
|
||||
def encode = TeardownConnection.encode(this)
|
||||
}
|
||||
|
||||
object TeardownConnection extends Marshallable[TeardownConnection] {
|
||||
implicit val codec : Codec[TeardownConnection] = (
|
||||
("nonce" | uint32L) ::
|
||||
("unk" | uint16).unit(6)
|
||||
).as[TeardownConnection]
|
||||
}
|
||||
|
|
@ -167,5 +167,24 @@ class ControlPacketTest extends Specification {
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
"TeardownConnection" should {
|
||||
val string = hex"00 05 02 4F 57 17 00 06"
|
||||
|
||||
"decode" in {
|
||||
PacketCoding.DecodePacket(string).require match {
|
||||
case TeardownConnection(nonce) =>
|
||||
nonce mustEqual 391597826
|
||||
case default =>
|
||||
ko
|
||||
}
|
||||
}
|
||||
|
||||
"encode" in {
|
||||
val encoded = PacketCoding.EncodePacket(TeardownConnection(391597826)).require
|
||||
|
||||
encoded.toByteVector mustEqual string
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue