fix bug which could cause multiple players to have the same ID (closes #154)

This commit is contained in:
Lion Kortlepel committed 2022-11-23 09:34:51 +01:00
1 parent 2f85c708c5
commit 8551e68184
2 files changed
+5

No files matched your search

+4
View File
@@ -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 {