mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-04-04 23:06:08 +00:00
fix bug which could cause multiple players to have the same ID (closes #154)
This commit is contained in:
@@ -577,6 +577,10 @@ void TNetwork::OnDisconnect(const std::weak_ptr<TClient>& ClientPtr) {
|
||||
}
|
||||
|
||||
int TNetwork::OpenID() {
|
||||
// This lock ensures that each call to OpenID is exclusive.
|
||||
// If we didn't have this, two concurrent calls to this function may result
|
||||
// in the same ID.
|
||||
std::unique_lock Lock(mOpenIDMutex);
|
||||
int ID = 0;
|
||||
bool found;
|
||||
do {
|
||||
|
||||
Reference in New Issue
Block a user