mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-22 07:41:20 -04:00
Verify before lock the mutex
This commit is contained in:
parent
089ea76a6e
commit
dafd975b51
1 changed files with 3 additions and 4 deletions
|
@ -1604,15 +1604,14 @@ ChatLobbyId DistributedChatService::createChatLobby(const std::string& lobby_nam
|
||||||
#endif
|
#endif
|
||||||
ChatLobbyId lobby_id ;
|
ChatLobbyId lobby_id ;
|
||||||
{
|
{
|
||||||
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
|
|
||||||
|
|
||||||
if (!rsIdentity->isOwnId(lobby_identity))
|
if (!rsIdentity->isOwnId(lobby_identity))
|
||||||
{
|
{
|
||||||
RsErr() << __PRETTY_FUNCTION__ << " lobby_identity RsGxsId id must be own" << std::endl;
|
RsErr() << __PRETTY_FUNCTION__ << " lobby_identity RsGxsId id must be own" << std::endl;
|
||||||
lobby_id = 00000000000000000000;
|
return 0;
|
||||||
return lobby_id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
RsStackMutex stack(mDistributedChatMtx); /********** STACK LOCKED MTX ******/
|
||||||
|
|
||||||
// create a unique id.
|
// create a unique id.
|
||||||
//
|
//
|
||||||
do { lobby_id = RSRandom::random_u64() ; } while(_chat_lobbys.find(lobby_id) != _chat_lobbys.end()) ;
|
do { lobby_id = RSRandom::random_u64() ; } while(_chat_lobbys.find(lobby_id) != _chat_lobbys.end()) ;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue