Error checks for BIO_get_event

ResetEvent before reading data from transport BIO.
This commit is contained in:
Armin Novak 2015-07-09 12:20:22 +02:00
parent 0120ee75ca
commit 098eda9873

View File

@ -674,7 +674,8 @@ DWORD transport_get_event_handles(rdpTransport* transport, HANDLE* events, DWORD
{
if (events && (nCount < count))
{
BIO_get_event(transport->frontBio, &events[nCount]);
if (BIO_get_event(transport->frontBio, &events[nCount]) != 1)
return 0;
nCount++;
}
}
@ -749,7 +750,8 @@ int transport_check_fds(rdpTransport* transport)
if (!transport)
return -1;
BIO_get_event(transport->frontBio, &event);
if (BIO_get_event(transport->frontBio, &event) != 1)
return -1;
/**
* Loop through and read all available PDUs. Since multiple
@ -758,6 +760,7 @@ int transport_check_fds(rdpTransport* transport)
* wait for a socket to get signaled that data is available
* (which may never happen).
*/
ResetEvent(event);
for (;;)
{
/**
@ -773,8 +776,6 @@ int transport_check_fds(rdpTransport* transport)
{
if (status < 0)
WLog_DBG(TAG, "transport_check_fds: transport_read_pdu() - %i", status);
ResetEvent(event);
return status;
}
@ -803,7 +804,6 @@ int transport_check_fds(rdpTransport* transport)
}
}
ResetEvent(event);
return 0;
}