Skip to content

Commit

Permalink
added a _cancelled flag for the client call to track if the call was …
Browse files Browse the repository at this point in the history
…cancelled. If cancelled then we need to signal occurrence no matter if the call is still under ActiveListCalls or not (#360)
  • Loading branch information
ni-sujain authored May 10, 2024
1 parent 5efe8ee commit 22643bb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/grpc_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ namespace grpc_labview
void ClientCall::Cancel()
{
_context.get()->Cancel();
_cancelled = true;
}

//---------------------------------------------------------------------
Expand Down Expand Up @@ -202,6 +203,10 @@ void CheckActiveAndSignalOccurenceForClientCall(grpc_labview::ClientCall *client
{
return;
}
if (clientCall->_cancelled == true)
{
grpc_labview::SignalOccurrence(clientCall->_occurrence);
}
std::unique_lock<std::mutex> lock(clientCall->_client->clientLock);
if (clientCall->_client->ActiveClientCalls.find(clientCall) != clientCall->_client->ActiveClientCalls.end())
{
Expand Down
1 change: 1 addition & 0 deletions src/grpc_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ namespace grpc_labview
grpc::Status _status;
std::future<int> _runFuture;
bool _useLVEfficientMessage;
bool _cancelled = false;
};

//---------------------------------------------------------------------
Expand Down

0 comments on commit 22643bb

Please sign in to comment.