mirror of
https://github.com/kidfromjupiter/nearby.git
synced 2026-09-14 22:56:12 -04:00
[Nearby] Acquire mutex in ClientProxy::GetLocalEndpointId
This method is called from multiple threads and needs to ensure the local_endpoint_id_ data member can be read/updated safely from multiple threads. PiperOrigin-RevId: 384337724
This commit is contained in:
committed by
Copybara-Service
parent
7c2e204b2c
commit
ea231c7138
@@ -48,6 +48,7 @@ ClientProxy::~ClientProxy() { Reset(); }
|
||||
std::int64_t ClientProxy::GetClientId() const { return client_id_; }
|
||||
|
||||
std::string ClientProxy::GetLocalEndpointId() {
|
||||
MutexLock lock(&mutex_);
|
||||
if (local_endpoint_id_.empty()) {
|
||||
local_endpoint_id_ = GenerateLocalEndpointId();
|
||||
NEARBY_LOGS(INFO) << "ClientProxy [Local Endpoint Generated]: client="
|
||||
|
||||
Reference in New Issue
Block a user