Skip to content

Commit

Permalink
tweak(server): move msgNetGameEventV2 for compatibility to sync thread
Browse files Browse the repository at this point in the history
  • Loading branch information
FabianTerhorst committed Oct 14, 2024
1 parent f6b8773 commit 63dafc3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@ class NetGameEventPacketHandlerV2
}

static void COMPONENT_EXPORT(CITIZEN_SERVER_IMPL) RouteEvent(const fwRefContainer<fx::ServerGameStatePublic>& sgs, uint32_t bucket, const std::vector<uint16_t>& targetPlayers, const fwRefContainer<fx::ClientRegistry>& clientRegistry, const net::Buffer& data);

void COMPONENT_EXPORT(CITIZEN_SERVER_IMPL) Handle(fx::ServerInstanceBase* instance, const fx::ClientSharedPtr& client, net::Buffer& packet);

static void COMPONENT_EXPORT(CITIZEN_SERVER_IMPL) HandleNetEvent(fx::ServerInstanceBase* instance, const fx::ClientSharedPtr& client, const net::Buffer& packet);

static constexpr const char* GetPacketId()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,15 @@ void NetGameEventPacketHandlerV2::RouteEvent(const fwRefContainer<fx::ServerGame
}
}

void NetGameEventPacketHandlerV2::Handle(fx::ServerInstanceBase* instance, const fx::ClientSharedPtr& client, net::Buffer& buffer)
void NetGameEventPacketHandlerV2::Handle(fx::ServerInstanceBase* instance, const fx::ClientSharedPtr& client, net::Buffer& packet)
{
gscomms_execute_callback_on_sync_thread([instance, client, packet = std::move(packet)]
{
HandleNetEvent(instance, client, packet);
});
}

void NetGameEventPacketHandlerV2::HandleNetEvent(fx::ServerInstanceBase* instance, const fx::ClientSharedPtr& client, const net::Buffer& buffer)
{
static size_t kClientMaxPacketSize = net::SerializableComponent::GetMaxSize<net::packet::ClientNetGameEventV2>();
static size_t kServerMaxReplySize = net::SerializableComponent::GetMaxSize<net::packet::ServerNetGameEventV2Packet>();
Expand Down

0 comments on commit 63dafc3

Please sign in to comment.