[WaitForXXObject] use infinite timeout where possible

This commit is contained in:
akallabeth
2025-06-03 08:49:28 +02:00
parent bf643b1394
commit da05b25f3b
3 changed files with 10 additions and 8 deletions

View File

@@ -296,8 +296,7 @@ static DWORD WINAPI audin_server_thread_func(LPVOID arg)
while (1)
{
if ((status = WaitForMultipleObjects(nCount, events, FALSE, 100)) == WAIT_OBJECT_0)
goto out;
status = WaitForMultipleObjects(nCount, events, FALSE, 100);
if (status == WAIT_FAILED)
{

View File

@@ -267,7 +267,7 @@ static DWORD WINAPI tf_client_thread_proc(LPVOID arg)
break;
}
status = WaitForMultipleObjects(nCount, handles, FALSE, 100);
status = WaitForMultipleObjects(nCount, handles, FALSE, INFINITE);
if (status == WAIT_FAILED)
{

View File

@@ -1003,25 +1003,28 @@ static int pollAndHandshake(rdpTls* tls)
do
{
HANDLE event = NULL;
HANDLE events[] = { freerdp_abort_event(tls->context), NULL };
DWORD status = 0;
if (BIO_get_event(tls->bio, &event) < 0)
if (BIO_get_event(tls->bio, &events[1]) < 0)
{
WLog_ERR(TAG, "unable to retrieve BIO associated event");
return -1;
}
if (!event)
if (!events[1])
{
WLog_ERR(TAG, "unable to retrieve BIO event");
return -1;
}
status = WaitForSingleObjectEx(event, 50, TRUE);
status = WaitForMultipleObjectsEx(ARRAYSIZE(events), events, FALSE, INFINITE, TRUE);
switch (status)
{
case WAIT_OBJECT_0:
case WAIT_OBJECT_0 + 1:
break;
case WAIT_OBJECT_0:
WLog_DBG(TAG, "Abort event set, cancel connect");
return -1;
case WAIT_TIMEOUT:
case WAIT_IO_COMPLETION:
continue;