Fixed channel duplicate disconnect handling

This commit is contained in:
Armin Novak 2018-04-09 11:09:59 +02:00
parent 973a4c30b8
commit d784954bca

View File

@ -1087,7 +1087,7 @@ static UINT encomsp_virtual_channel_event_connected(encomspPlugin* encomsp,
} }
if (!(encomsp->thread = CreateThread(NULL, 0, if (!(encomsp->thread = CreateThread(NULL, 0,
encomsp_virtual_channel_client_thread, (void*) encomsp, encomsp_virtual_channel_client_thread, (void*) encomsp,
0, NULL))) 0, NULL)))
{ {
WLog_ERR(TAG, "CreateThread failed!"); WLog_ERR(TAG, "CreateThread failed!");
@ -1107,6 +1107,9 @@ static UINT encomsp_virtual_channel_event_disconnected(encomspPlugin* encomsp)
{ {
UINT rc; UINT rc;
if (encomsp->OpenHandle == 0)
return CHANNEL_RC_OK;
if (MessageQueue_PostQuit(encomsp->queue, 0) if (MessageQueue_PostQuit(encomsp->queue, 0)
&& (WaitForSingleObject(encomsp->thread, INFINITE) == WAIT_FAILED)) && (WaitForSingleObject(encomsp->thread, INFINITE) == WAIT_FAILED))
{ {