Fix server side code to be aware of rereadEvent
This commit is contained in:
parent
043243f43c
commit
ddc326d6d3
@ -34,7 +34,7 @@ typedef void (*psPeerContextFree)(freerdp_peer* peer, rdpContext* context);
|
|||||||
|
|
||||||
typedef BOOL (*psPeerInitialize)(freerdp_peer* peer);
|
typedef BOOL (*psPeerInitialize)(freerdp_peer* peer);
|
||||||
typedef BOOL (*psPeerGetFileDescriptor)(freerdp_peer* peer, void** rfds, int* rcount);
|
typedef BOOL (*psPeerGetFileDescriptor)(freerdp_peer* peer, void** rfds, int* rcount);
|
||||||
typedef HANDLE(*psPeerGetEventHandle)(freerdp_peer* peer);
|
typedef DWORD (*psPeerGetEventHandles)(freerdp_peer* peer, HANDLE* events, DWORD count);
|
||||||
typedef HANDLE(*psPeerGetReceiveEventHandle)(freerdp_peer* peer);
|
typedef HANDLE(*psPeerGetReceiveEventHandle)(freerdp_peer* peer);
|
||||||
typedef BOOL (*psPeerCheckFileDescriptor)(freerdp_peer* peer);
|
typedef BOOL (*psPeerCheckFileDescriptor)(freerdp_peer* peer);
|
||||||
typedef BOOL (*psPeerIsWriteBlocked)(freerdp_peer* peer);
|
typedef BOOL (*psPeerIsWriteBlocked)(freerdp_peer* peer);
|
||||||
@ -79,7 +79,7 @@ struct rdp_freerdp_peer
|
|||||||
|
|
||||||
psPeerInitialize Initialize;
|
psPeerInitialize Initialize;
|
||||||
psPeerGetFileDescriptor GetFileDescriptor;
|
psPeerGetFileDescriptor GetFileDescriptor;
|
||||||
psPeerGetEventHandle GetEventHandle;
|
psPeerGetEventHandles GetEventHandles;
|
||||||
psPeerGetReceiveEventHandle GetReceiveEventHandle;
|
psPeerGetReceiveEventHandle GetReceiveEventHandle;
|
||||||
psPeerCheckFileDescriptor CheckFileDescriptor;
|
psPeerCheckFileDescriptor CheckFileDescriptor;
|
||||||
psPeerClose Close;
|
psPeerClose Close;
|
||||||
|
@ -244,17 +244,19 @@ static BOOL freerdp_peer_initialize(freerdp_peer* client)
|
|||||||
static BOOL freerdp_peer_get_fds(freerdp_peer* client, void** rfds, int* rcount)
|
static BOOL freerdp_peer_get_fds(freerdp_peer* client, void** rfds, int* rcount)
|
||||||
{
|
{
|
||||||
rdpTransport* transport = client->context->rdp->transport;
|
rdpTransport* transport = client->context->rdp->transport;
|
||||||
rfds[*rcount] = (void*)(long)(BIO_get_fd(transport->frontBio, NULL));
|
transport_get_fds(transport, rfds, rcount);
|
||||||
(*rcount)++;
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static HANDLE freerdp_peer_get_event_handle(freerdp_peer* client)
|
static DWORD freerdp_peer_get_event_handles(freerdp_peer* client, HANDLE* events, DWORD count)
|
||||||
{
|
{
|
||||||
HANDLE hEvent = NULL;
|
DWORD nCount = 0;
|
||||||
rdpTransport* transport = client->context->rdp->transport;
|
nCount += transport_get_event_handles(client->context->rdp->transport, events, count);
|
||||||
BIO_get_event(transport->frontBio, &hEvent);
|
|
||||||
return hEvent;
|
if (nCount == 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
return nCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL freerdp_peer_check_fds(freerdp_peer* peer)
|
static BOOL freerdp_peer_check_fds(freerdp_peer* peer)
|
||||||
@ -805,7 +807,7 @@ freerdp_peer* freerdp_peer_new(int sockfd)
|
|||||||
client->ContextSize = sizeof(rdpContext);
|
client->ContextSize = sizeof(rdpContext);
|
||||||
client->Initialize = freerdp_peer_initialize;
|
client->Initialize = freerdp_peer_initialize;
|
||||||
client->GetFileDescriptor = freerdp_peer_get_fds;
|
client->GetFileDescriptor = freerdp_peer_get_fds;
|
||||||
client->GetEventHandle = freerdp_peer_get_event_handle;
|
client->GetEventHandles = freerdp_peer_get_event_handles;
|
||||||
client->CheckFileDescriptor = freerdp_peer_check_fds;
|
client->CheckFileDescriptor = freerdp_peer_check_fds;
|
||||||
client->Close = freerdp_peer_close;
|
client->Close = freerdp_peer_close;
|
||||||
client->Disconnect = freerdp_peer_disconnect;
|
client->Disconnect = freerdp_peer_disconnect;
|
||||||
|
@ -803,7 +803,17 @@ static void* test_peer_mainloop(void* arg)
|
|||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
count = 0;
|
count = 0;
|
||||||
handles[count++] = client->GetEventHandle(client);
|
{
|
||||||
|
DWORD tmp = client->GetEventHandles(client, &handles[count], 32 - count);
|
||||||
|
|
||||||
|
if (tmp == 0)
|
||||||
|
{
|
||||||
|
WLog_ERR(TAG, "Failed to get FreeRDP transport event handles");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
count += tmp;
|
||||||
|
}
|
||||||
handles[count++] = WTSVirtualChannelManagerGetEventHandle(context->vcm);
|
handles[count++] = WTSVirtualChannelManagerGetEventHandle(context->vcm);
|
||||||
status = WaitForMultipleObjects(count, handles, FALSE, INFINITE);
|
status = WaitForMultipleObjects(count, handles, FALSE, INFINITE);
|
||||||
|
|
||||||
|
@ -1454,7 +1454,6 @@ static void* shadow_client_thread(rdpShadowClient* client)
|
|||||||
wMessage pointerAlphaMsg;
|
wMessage pointerAlphaMsg;
|
||||||
wMessage audioVolumeMsg;
|
wMessage audioVolumeMsg;
|
||||||
HANDLE events[32];
|
HANDLE events[32];
|
||||||
HANDLE ClientEvent;
|
|
||||||
HANDLE ChannelEvent;
|
HANDLE ChannelEvent;
|
||||||
void* UpdateSubscriber;
|
void* UpdateSubscriber;
|
||||||
HANDLE UpdateEvent;
|
HANDLE UpdateEvent;
|
||||||
@ -1497,14 +1496,23 @@ static void* shadow_client_thread(rdpShadowClient* client)
|
|||||||
goto out;
|
goto out;
|
||||||
|
|
||||||
UpdateEvent = shadow_multiclient_getevent(UpdateSubscriber);
|
UpdateEvent = shadow_multiclient_getevent(UpdateSubscriber);
|
||||||
ClientEvent = peer->GetEventHandle(peer);
|
|
||||||
ChannelEvent = WTSVirtualChannelManagerGetEventHandle(client->vcm);
|
ChannelEvent = WTSVirtualChannelManagerGetEventHandle(client->vcm);
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
nCount = 0;
|
nCount = 0;
|
||||||
events[nCount++] = UpdateEvent;
|
events[nCount++] = UpdateEvent;
|
||||||
events[nCount++] = ClientEvent;
|
{
|
||||||
|
DWORD tmp = peer->GetEventHandles(peer, &events[nCount], 64 - nCount);
|
||||||
|
|
||||||
|
if (tmp == 0)
|
||||||
|
{
|
||||||
|
WLog_ERR(TAG, "Failed to get FreeRDP transport event handles");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
nCount += tmp;
|
||||||
|
}
|
||||||
events[nCount++] = ChannelEvent;
|
events[nCount++] = ChannelEvent;
|
||||||
events[nCount++] = MessageQueue_Event(MsgQueue);
|
events[nCount++] = MessageQueue_Event(MsgQueue);
|
||||||
status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);
|
status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);
|
||||||
@ -1559,14 +1567,13 @@ static void* shadow_client_thread(rdpShadowClient* client)
|
|||||||
(void)shadow_multiclient_consume(UpdateSubscriber);
|
(void)shadow_multiclient_consume(UpdateSubscriber);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (WaitForSingleObject(ClientEvent, 0) == WAIT_OBJECT_0)
|
if (!peer->CheckFileDescriptor(peer))
|
||||||
|
{
|
||||||
|
WLog_ERR(TAG, "Failed to check FreeRDP file descriptor");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
if (!peer->CheckFileDescriptor(peer))
|
|
||||||
{
|
|
||||||
WLog_ERR(TAG, "Failed to check FreeRDP file descriptor");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (WTSVirtualChannelManagerIsChannelJoined(client->vcm, "drdynvc"))
|
if (WTSVirtualChannelManagerIsChannelJoined(client->vcm, "drdynvc"))
|
||||||
{
|
{
|
||||||
/* Dynamic channel status may have been changed after processing */
|
/* Dynamic channel status may have been changed after processing */
|
||||||
|
Loading…
Reference in New Issue
Block a user