ni / grpc-labview

gRPC client and server support for LabVIEW
MIT License
85 stars 60 forks source link

added a _cancelled flag for the client call to track if the call was cancelled #360

Closed ni-sujain closed 4 months ago

ni-sujain commented 4 months ago

fix for #345 #354 When we have multiple streaming calls doing read operations in parallel and we cancel those calls, some of the calls will complete with correct error status(as they finished reading the stream and the subsequent reads are not valid) and some calls might hang as they are waiting on occurrence to get signaled from async c++ thread.

When we cancelled the calls, they get removed form ActiveCalls list. Once we complete any read in async C++ thread, we always signal the occurrence corresponding to calls present in this active call list only. But if the call was cancelled, it will get removed this list and we will end up not signaling for it and VI will hang in Wait for occurrence.

To fix this added a _cancelled flag in ClientCall to keep track if the call was cancelled. If cancelled that async ++ thread will signal occurrence now.

Note: I want to add one LV client server test for this but I have to add some infrastructure to do that in existing ATS.