rpc_client_stop() : Avoid waiting infinitely for rpc client thread if connection...
authorBenoit LeBlanc <benoit.leblanc@awakecoding.com>
Thu, 24 Apr 2014 18:07:11 +0000 (14:07 -0400)
committerBenoit LeBlanc <benoit.leblanc@awakecoding.com>
Thu, 24 Apr 2014 18:07:11 +0000 (14:07 -0400)
libfreerdp/core/gateway/rpc_client.c

index 827c528..fea7ffd 100644 (file)
@@ -599,9 +599,12 @@ int rpc_client_start(rdpRpc* rpc)
 
 int rpc_client_stop(rdpRpc* rpc)
 {
-       SetEvent(rpc->client->StopEvent);
+       if (rpc->client->SynchronousReceive == FALSE)
+       {
+               SetEvent(rpc->client->StopEvent);
 
-       WaitForSingleObject(rpc->client->Thread, INFINITE);
+               WaitForSingleObject(rpc->client->Thread, INFINITE);
+       }
 
        rpc_client_free(rpc);