mirror of https://github.com/FreeRDP/FreeRDP
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 (*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 BOOL (*psPeerCheckFileDescriptor)(freerdp_peer* peer);
|
||||
typedef BOOL (*psPeerIsWriteBlocked)(freerdp_peer* peer);
|
||||
|
@ -79,7 +79,7 @@ struct rdp_freerdp_peer
|
|||
|
||||
psPeerInitialize Initialize;
|
||||
psPeerGetFileDescriptor GetFileDescriptor;
|
||||
psPeerGetEventHandle GetEventHandle;
|
||||
psPeerGetEventHandles GetEventHandles;
|
||||
psPeerGetReceiveEventHandle GetReceiveEventHandle;
|
||||
psPeerCheckFileDescriptor CheckFileDescriptor;
|
||||
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)
|
||||
{
|
||||
rdpTransport* transport = client->context->rdp->transport;
|
||||
rfds[*rcount] = (void*)(long)(BIO_get_fd(transport->frontBio, NULL));
|
||||
(*rcount)++;
|
||||
transport_get_fds(transport, rfds, rcount);
|
||||
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;
|
||||
rdpTransport* transport = client->context->rdp->transport;
|
||||
BIO_get_event(transport->frontBio, &hEvent);
|
||||
return hEvent;
|
||||
DWORD nCount = 0;
|
||||
nCount += transport_get_event_handles(client->context->rdp->transport, events, count);
|
||||
|
||||
if (nCount == 0)
|
||||
return 0;
|
||||
|
||||
return nCount;
|
||||
}
|
||||
|
||||
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->Initialize = freerdp_peer_initialize;
|
||||
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->Close = freerdp_peer_close;
|
||||
client->Disconnect = freerdp_peer_disconnect;
|
||||
|
|
|
@ -803,7 +803,17 @@ static void* test_peer_mainloop(void* arg)
|
|||
while (1)
|
||||
{
|
||||
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);
|
||||
status = WaitForMultipleObjects(count, handles, FALSE, INFINITE);
|
||||
|
||||
|
|
|
@ -1454,7 +1454,6 @@ static void* shadow_client_thread(rdpShadowClient* client)
|
|||
wMessage pointerAlphaMsg;
|
||||
wMessage audioVolumeMsg;
|
||||
HANDLE events[32];
|
||||
HANDLE ClientEvent;
|
||||
HANDLE ChannelEvent;
|
||||
void* UpdateSubscriber;
|
||||
HANDLE UpdateEvent;
|
||||
|
@ -1497,14 +1496,23 @@ static void* shadow_client_thread(rdpShadowClient* client)
|
|||
goto out;
|
||||
|
||||
UpdateEvent = shadow_multiclient_getevent(UpdateSubscriber);
|
||||
ClientEvent = peer->GetEventHandle(peer);
|
||||
ChannelEvent = WTSVirtualChannelManagerGetEventHandle(client->vcm);
|
||||
|
||||
while (1)
|
||||
{
|
||||
nCount = 0;
|
||||
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++] = MessageQueue_Event(MsgQueue);
|
||||
status = WaitForMultipleObjects(nCount, events, FALSE, INFINITE);
|
||||
|
@ -1559,14 +1567,13 @@ static void* shadow_client_thread(rdpShadowClient* client)
|
|||
(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"))
|
||||
{
|
||||
/* Dynamic channel status may have been changed after processing */
|
||||
|
|
Loading…
Reference in New Issue