Listen to CHANNEL_EVENT_WRITE_CANCELLED and emit if queue is cleared.

This commit is contained in:
Armin Novak 2019-10-28 15:13:42 +01:00
parent 1b78b59926
commit 1bcb799560
8 changed files with 15 additions and 6 deletions

View File

@ -872,6 +872,7 @@ static VOID VCAPITYPE cliprdr_virtual_channel_open_event_ex(LPVOID lpUserParam,
break;
case CHANNEL_EVENT_WRITE_CANCELLED:
case CHANNEL_EVENT_WRITE_COMPLETE:
{
wStream* s = (wStream*)lpUserParam;

View File

@ -1271,6 +1271,7 @@ static void VCAPITYPE drdynvc_virtual_channel_open_event_ex(LPVOID lpUserParam,
break;
case CHANNEL_EVENT_WRITE_CANCELLED:
case CHANNEL_EVENT_WRITE_COMPLETE:
{
wStream* s = (wStream*)lpUserParam;

View File

@ -1002,6 +1002,7 @@ static VOID VCAPITYPE encomsp_virtual_channel_open_event_ex(LPVOID lpUserParam,
break;
case CHANNEL_EVENT_WRITE_CANCELLED:
case CHANNEL_EVENT_WRITE_COMPLETE:
{
wStream* s = (wStream*)lpUserParam;

View File

@ -705,6 +705,7 @@ static VOID VCAPITYPE rail_virtual_channel_open_event_ex(LPVOID lpUserParam, DWO
break;
case CHANNEL_EVENT_WRITE_CANCELLED:
case CHANNEL_EVENT_WRITE_COMPLETE:
{
wStream* s = (wStream*)lpUserParam;

View File

@ -232,6 +232,9 @@ static void VCAPITYPE VirtualChannelOpenEventEx(LPVOID lpUserParam, DWORD openHa
dataReceived(plugin, pData, dataLength, totalLength, dataFlags);
break;
case CHANNEL_EVENT_WRITE_CANCELLED:
free(lpUserParam);
break;
case CHANNEL_EVENT_WRITE_COMPLETE:
SetEvent(plugin->writeComplete);
free(lpUserParam);

View File

@ -1587,6 +1587,7 @@ static VOID VCAPITYPE rdpdr_virtual_channel_open_event_ex(LPVOID lpUserParam, DW
break;
case CHANNEL_EVENT_WRITE_CANCELLED:
case CHANNEL_EVENT_WRITE_COMPLETE:
{
wStream* s = (wStream*)lpUserParam;

View File

@ -990,6 +990,7 @@ static VOID VCAPITYPE rdpsnd_virtual_channel_open_event_ex(LPVOID lpUserParam, D
break;
case CHANNEL_EVENT_WRITE_CANCELLED:
case CHANNEL_EVENT_WRITE_COMPLETE:
{
wStream* s = (wStream*)lpUserParam;

View File

@ -38,7 +38,7 @@ static volatile LONG g_OpenHandleSeq =
1; /* use global counter to ensure uniqueness across channel manager instances */
static WINPR_TLS rdpChannelHandles g_ChannelHandles = { NULL, NULL };
static BOOL freerdp_channels_process_message_free(wMessage* message);
static BOOL freerdp_channels_process_message_free(wMessage* message, DWORD type);
static CHANNEL_OPEN_DATA* freerdp_channels_find_channel_open_data_by_name(
rdpChannels* channels, const char* name)
@ -86,7 +86,7 @@ static void channel_queue_message_free(wMessage* msg)
return;
ev = (CHANNEL_OPEN_EVENT*)msg->wParam;
freerdp_channels_process_message_free(msg);
freerdp_channels_process_message_free(msg, CHANNEL_EVENT_WRITE_CANCELLED);
free(ev);
}
@ -442,7 +442,7 @@ int freerdp_channels_data(freerdp* instance, UINT16 channelId, BYTE* data,
return 0;
}
BOOL freerdp_channels_process_message_free(wMessage* message)
BOOL freerdp_channels_process_message_free(wMessage* message, DWORD type)
{
if (message->id == WMQ_QUIT)
{
@ -462,14 +462,14 @@ BOOL freerdp_channels_process_message_free(wMessage* message)
if (pChannelOpenData->pChannelOpenEventProc)
{
pChannelOpenData->pChannelOpenEventProc(pChannelOpenData->OpenHandle,
CHANNEL_EVENT_WRITE_COMPLETE, item->UserData,
type, item->UserData,
item->DataLength, item->DataLength, 0);
}
else if (pChannelOpenData->pChannelOpenEventProcEx)
{
pChannelOpenData->pChannelOpenEventProcEx(pChannelOpenData->lpUserParam,
pChannelOpenData->OpenHandle,
CHANNEL_EVENT_WRITE_COMPLETE, item->UserData,
type, item->UserData,
item->DataLength, item->DataLength, 0);
}
}
@ -501,7 +501,7 @@ static BOOL freerdp_channels_process_message(freerdp* instance, wMessage* messag
instance->SendChannelData(instance, channel->ChannelId, item->Data, item->DataLength);
}
if (!freerdp_channels_process_message_free(message))
if (!freerdp_channels_process_message_free(message, CHANNEL_EVENT_WRITE_COMPLETE))
return FALSE;
IFCALL(message->Free, message);