Skip to content

Commit

Permalink
Rename and correct packet Unknown30 to ClientHotStart (#1217)
Browse files Browse the repository at this point in the history
This packet contains the client and server nonce needed to restart a connection using old crypto data.
  • Loading branch information
Resaec authored Jul 29, 2024
1 parent d1dbbcb commit 8738a42
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 21 deletions.
8 changes: 4 additions & 4 deletions src/main/scala/net/psforever/actors/net/MiddlewareActor.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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?
*/
Expand Down Expand Up @@ -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?
*/
Expand Down
4 changes: 2 additions & 2 deletions src/main/scala/net/psforever/packet/ControlPacketOpcode.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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) =
Expand Down Expand Up @@ -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)
}

Expand Down
18 changes: 18 additions & 0 deletions src/main/scala/net/psforever/packet/control/ClientHotStart.scala
Original file line number Diff line number Diff line change
@@ -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]
}
15 changes: 0 additions & 15 deletions src/main/scala/net/psforever/packet/control/Unknown30.scala

This file was deleted.

0 comments on commit 8738a42

Please sign in to comment.