From c17f510bb77abb2e6b72190731421506f4a88641 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Mon, 19 Aug 2024 22:28:50 +0800 Subject: [PATCH] [raknet] Match `RakPeer::Receive()` --- raknet/RakPeer.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/raknet/RakPeer.cpp b/raknet/RakPeer.cpp index 2dc3c57..21ef204 100644 --- a/raknet/RakPeer.cpp +++ b/raknet/RakPeer.cpp @@ -909,9 +909,13 @@ Packet* RakPeer::Receive( void ) Packet *packet = ReceiveIgnoreRPC(); while (packet && (packet->data[ 0 ] == ID_RPC || (packet->length>sizeof(unsigned char)+sizeof(RakNetTime) && packet->data[0]==ID_TIMESTAMP && packet->data[sizeof(unsigned char)+sizeof(RakNetTime)]==ID_RPC))) { - // Do RPC calls from the user thread, not the network update thread - // If we are currently blocking on an RPC reply, send ID_RPC to the blocker to handle rather than handling RPCs automatically - HandleRPCPacket( ( char* ) packet->data, packet->length, packet->playerId ); + if (packet->playerId != UNASSIGNED_PLAYER_ID) + { + // Do RPC calls from the user thread, not the network update thread + // If we are currently blocking on an RPC reply, send ID_RPC to the blocker to handle rather than handling RPCs automatically + HandleRPCPacket( ( char* ) packet->data, packet->length, packet->playerId ); + } + DeallocatePacket( packet ); packet = ReceiveIgnoreRPC();