mirror of
https://github.com/psforever/PSF-LoginServer.git
synced 2026-01-19 18:44:45 +00:00
Work around scodec-akka bug and remove old UDP packet
This commit is contained in:
parent
8b8194cb44
commit
c18ec5c6ba
|
|
@ -56,9 +56,6 @@ class SessionRouter(pipeline : List[SessionPipeline]) extends Actor with MDCCont
|
|||
def initializing : Receive = {
|
||||
case Hello() =>
|
||||
inputRef = sender()
|
||||
|
||||
inputRef ! SendPacket(hex"41414141", new InetSocketAddress("8.8.8.8", 51000))
|
||||
|
||||
context.become(started)
|
||||
case default =>
|
||||
log.error(s"Unknown message $default. Stopping...")
|
||||
|
|
|
|||
|
|
@ -4,8 +4,9 @@ import java.net.{InetAddress, InetSocketAddress}
|
|||
import akka.actor.SupervisorStrategy.{Restart, Stop}
|
||||
import akka.actor.{Actor, ActorRef, OneForOneStrategy, Props, Terminated}
|
||||
import akka.io._
|
||||
import scodec.bits.ByteVector
|
||||
import scodec.bits._
|
||||
import scodec.interop.akka._
|
||||
import akka.util.ByteString
|
||||
|
||||
final case class ReceivedPacket(msg : ByteVector, from : InetSocketAddress)
|
||||
final case class SendPacket(msg : ByteVector, to : InetSocketAddress)
|
||||
|
|
@ -40,7 +41,8 @@ class UdpListener(nextActorProps : Props, nextActorName : String, address : Inet
|
|||
def ready(socket: ActorRef): Receive = {
|
||||
case SendPacket(msg, to) =>
|
||||
bytesSent += msg.size
|
||||
socket ! Udp.Send(msg.toByteString, to)
|
||||
// XXX: revert back to msg.toByteString when scodec-akka is unbroken... (this is doing a copy)
|
||||
socket ! Udp.Send(ByteString(msg.toByteBuffer), to)
|
||||
case Udp.Received(data, remote) =>
|
||||
bytesRecevied += data.size
|
||||
nextActor ! ReceivedPacket(data.toByteVector, remote)
|
||||
|
|
|
|||
Loading…
Reference in a new issue