Skip to content

Commit c622068

Browse files
committed
fix reservedSlots being reset after raknet start
1 parent 2e4491d commit c622068

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

Server/Components/LegacyNetwork/legacy_network_impl.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,15 @@ void RakNetLegacyNetwork::start()
905905
{
906906
SAMPRakNet::SetGracePeriod(*gracePeriod);
907907
}
908+
909+
// Set reserved slots based on NPC count once more because slots reserved
910+
// Before RakServer::Start are reset because RakPeer::Start calls RakPeer::Disconnect
911+
// As well which resets the value for RakPeer::reservedSlots class member.
912+
// Note: this behavior does not affect slots reserved in next executions.
913+
if (npcComponent)
914+
{
915+
rakNetServer.ReserveSlots(npcComponent->count());
916+
}
908917
}
909918

910919
void RakNetLegacyNetwork::onTick(Microseconds elapsed, TimePoint now)

lib/RakNet

0 commit comments

Comments
 (0)