Skip to content

Commit

Permalink
fix sideband race condition by passing std::string instead of char* t…
Browse files Browse the repository at this point in the history
…o thread proc (#1131)
  • Loading branch information
asumit authored Nov 27, 2024
1 parent dea3b5a commit 06ed455
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion source/server/data_moniker_service.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ Status DataMonikerService::BeginSidebandStream(ServerContext* context, const Beg

char identifier[32] = {};
InitOwnerSidebandData(strategy, bufferSize, identifier);
std::string identifierString(identifier);

response->set_strategy(request->strategy());
response->set_sideband_identifier(identifier);
Expand All @@ -179,7 +180,7 @@ Status DataMonikerService::BeginSidebandStream(ServerContext* context, const Beg
auto readers = new EndpointList();
InitiateMonikerList(request->monikers(), readers, writers);

auto thread = new std::thread(RunSidebandReadWriteLoop, identifier, strategy, readers, writers);
auto thread = new std::thread(RunSidebandReadWriteLoop, identifierString, strategy, readers, writers);
thread->detach();

return Status::OK;
Expand Down

0 comments on commit 06ed455

Please sign in to comment.