Rename and correct packet Unknown30 to ClientHotStart (#1217)

This packet contains the client and server nonce needed to restart a connection using old crypto data.
This commit is contained in:
Resaec 2024-07-29 08:18:04 +02:00 committed by GitHub
parent d1dbbcb08f
commit 8738a42ca0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 24 additions and 21 deletions

View file

@ -308,9 +308,9 @@ class MiddlewareActor(
send(ServerStart(nonce, serverNonce), None, None)
cryptoSetup()
case (Unknown30(_), _) =>
case (ClientHotStart(_, _), _) =>
/*
Unknown30 is used to reuse an existing crypto session when switching from login to world
ClientHotStart is used to reuse an existing crypto session when switching from login to world
When not handling it, it appears that the client will fall back to using ClientStart
Do we need to implement this?
*/
@ -586,9 +586,9 @@ class MiddlewareActor(
case ClientStart(_) =>
start()
case Unknown30(_) =>
case ClientHotStart(_, _) =>
/*
Unknown30 is used to reuse an existing crypto session when switching from login to world
ClientHotStart is used to reuse an existing crypto session when switching from login to world
When not handling it, it appears that the client will fall back to using ClientStart
Do we need to implement this?
*/

View file

@ -45,7 +45,7 @@ object ControlPacketOpcode extends Enumeration {
Unknown27, //
Unknown28, //
ConnectionClose, //
Unknown30 // Probably a more lightweight variant of ClientStart, containing only the client nonce
ClientHotStart // Probably a more lightweight variant of ClientStart, containing only the client nonce
= Value
private def noDecoder(opcode: ControlPacketOpcode.Type) =
@ -90,7 +90,7 @@ object ControlPacketOpcode extends Enumeration {
case 0x1b => noDecoder(Unknown27)
case 0x1c => noDecoder(Unknown28)
case 0x1d => control.ConnectionClose.decode
case 0x1e => control.Unknown30.decode
case 0x1e => control.ClientHotStart.decode
case _ => noDecoder(opcode)
}

View file

@ -0,0 +1,18 @@
package net.psforever.packet.control
import net.psforever.packet.{ControlPacketOpcode, Marshallable, PlanetSideControlPacket}
import scodec.Codec
import scodec.codecs._
final case class ClientHotStart(clientNonce: Long, ServerNonce: Long) extends PlanetSideControlPacket {
type Packet = ClientHotStart
def opcode = ControlPacketOpcode.ClientHotStart
def encode = ClientHotStart.encode(this)
}
object ClientHotStart extends Marshallable[ClientHotStart] {
implicit val codec: Codec[ClientHotStart] = (
("client_nonce" | uint32L) ::
("server_nonce" | uint32L)
).as[ClientHotStart]
}

View file

@ -1,15 +0,0 @@
package net.psforever.packet.control
import net.psforever.packet.{ControlPacketOpcode, Marshallable, PlanetSideControlPacket}
import scodec.Codec
import scodec.codecs._
final case class Unknown30(clientNonce: Long) extends PlanetSideControlPacket {
type Packet = Unknown30
def opcode = ControlPacketOpcode.Unknown30
def encode = Unknown30.encode(this)
}
object Unknown30 extends Marshallable[Unknown30] {
implicit val codec: Codec[Unknown30] = ("client_nonce" | uint32L).as[Unknown30]
}