Using new API for socket listener.
This commit is contained in:
parent
4ed891b599
commit
7b0d7b3552
@ -738,51 +738,26 @@ static void test_peer_accepted(freerdp_listener* instance, freerdp_peer* client)
|
|||||||
|
|
||||||
static void test_server_mainloop(freerdp_listener* instance)
|
static void test_server_mainloop(freerdp_listener* instance)
|
||||||
{
|
{
|
||||||
int i;
|
HANDLE handles[32];
|
||||||
int fds;
|
DWORD count;
|
||||||
int max_fds;
|
DWORD status;
|
||||||
int rcount;
|
|
||||||
void* rfds[32];
|
|
||||||
fd_set rfds_set;
|
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
rcount = 0;
|
count = 0;
|
||||||
|
|
||||||
memset(rfds, 0, sizeof(rfds));
|
if (instance->GetEventHandles(instance, handles, &count))
|
||||||
if (instance->GetFileDescriptor(instance, rfds, &rcount) != TRUE)
|
|
||||||
{
|
{
|
||||||
WLog_ERR(TAG, "Failed to get FreeRDP file descriptor");
|
WLog_ERR(TAG, "Failed to get FreeRDP event handles");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
max_fds = 0;
|
status = WaitForMultipleObjects(count, handles, FALSE, INFINITE);
|
||||||
FD_ZERO(&rfds_set);
|
|
||||||
|
|
||||||
for (i = 0; i < rcount; i++)
|
if (WAIT_FAILED == status)
|
||||||
{
|
{
|
||||||
fds = (int)(long)(rfds[i]);
|
WLog_ERR(TAG, "select failed");
|
||||||
|
|
||||||
if (fds > max_fds)
|
|
||||||
max_fds = fds;
|
|
||||||
|
|
||||||
FD_SET(fds, &rfds_set);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (max_fds == 0)
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (select(max_fds + 1, &rfds_set, NULL, NULL, NULL) == -1)
|
|
||||||
{
|
|
||||||
/* these are not really errors */
|
|
||||||
if (!((errno == EAGAIN) ||
|
|
||||||
(errno == EWOULDBLOCK) ||
|
|
||||||
(errno == EINPROGRESS) ||
|
|
||||||
(errno == EINTR))) /* signal occurred */
|
|
||||||
{
|
|
||||||
WLog_ERR(TAG, "select failed");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (instance->CheckFileDescriptor(instance) != TRUE)
|
if (instance->CheckFileDescriptor(instance) != TRUE)
|
||||||
|
Loading…
Reference in New Issue
Block a user