mirror of
https://github.com/morgan9e/FreeRDP
synced 2026-04-15 00:44:19 +09:00
Added deprecation to *get_fds functions
This commit is contained in:
@@ -25,6 +25,7 @@
|
||||
#include <winpr/tchar.h>
|
||||
#include <winpr/windows.h>
|
||||
#include <winpr/winsock.h>
|
||||
#include <winpr/assert.h>
|
||||
|
||||
#include <freerdp/freerdp.h>
|
||||
#include <freerdp/listener.h>
|
||||
@@ -87,11 +88,6 @@ void set_screen_id(int id)
|
||||
|
||||
static DWORD WINAPI wf_server_main_loop(LPVOID lpParam)
|
||||
{
|
||||
int i, fds;
|
||||
int rcount;
|
||||
int max_fds;
|
||||
void* rfds[32];
|
||||
fd_set rfds_set;
|
||||
freerdp_listener* instance;
|
||||
wfInfo* wfi;
|
||||
|
||||
@@ -104,36 +100,29 @@ static DWORD WINAPI wf_server_main_loop(LPVOID lpParam)
|
||||
|
||||
wfi->force_all_disconnect = FALSE;
|
||||
|
||||
ZeroMemory(rfds, sizeof(rfds));
|
||||
instance = (freerdp_listener*)lpParam;
|
||||
WINPR_ASSERT(instance);
|
||||
WINPR_ASSERT(instance->GetEventHandles);
|
||||
WINPR_ASSERT(instance->CheckFileDescriptor);
|
||||
|
||||
while (wfi->force_all_disconnect == FALSE)
|
||||
{
|
||||
rcount = 0;
|
||||
DWORD status;
|
||||
HANDLE handles[MAXIMUM_WAIT_OBJECTS] = { 0 };
|
||||
DWORD count = instance->GetEventHandles(instance, handles, ARRAYSIZE(handles));
|
||||
|
||||
if (instance->GetFileDescriptor(instance, rfds, &rcount) != TRUE)
|
||||
if (count == 0)
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to get FreeRDP file descriptor");
|
||||
break;
|
||||
}
|
||||
|
||||
max_fds = 0;
|
||||
FD_ZERO(&rfds_set);
|
||||
|
||||
for (i = 0; i < rcount; i++)
|
||||
status = WaitForMultipleObjects(handles, count, FALSE, INFINITE);
|
||||
if (status == WAIT_FAILED)
|
||||
{
|
||||
fds = (int)(long)(rfds[i]);
|
||||
|
||||
if (fds > max_fds)
|
||||
max_fds = fds;
|
||||
|
||||
FD_SET(fds, &rfds_set);
|
||||
}
|
||||
|
||||
if (max_fds == 0)
|
||||
WLog_ERR(TAG, "WaitForMultipleObjects failed");
|
||||
break;
|
||||
|
||||
select(max_fds + 1, &rfds_set, NULL, NULL, NULL);
|
||||
}
|
||||
|
||||
if (instance->CheckFileDescriptor(instance) != TRUE)
|
||||
{
|
||||
|
||||
@@ -167,43 +167,35 @@ BOOL wf_peer_accepted(freerdp_listener* instance, freerdp_peer* client)
|
||||
|
||||
static DWORD WINAPI wf_peer_socket_listener(LPVOID lpParam)
|
||||
{
|
||||
int i, fds;
|
||||
int rcount;
|
||||
int max_fds;
|
||||
void* rfds[32];
|
||||
fd_set rfds_set;
|
||||
wfPeerContext* context;
|
||||
freerdp_peer* client = (freerdp_peer*)lpParam;
|
||||
ZeroMemory(rfds, sizeof(rfds));
|
||||
|
||||
WINPR_ASSERT(client);
|
||||
WINPR_ASSERT(client->GetEventHandles);
|
||||
WINPR_ASSERT(client->CheckFileDescriptor);
|
||||
|
||||
context = (wfPeerContext*)client->context;
|
||||
WINPR_ASSERT(context);
|
||||
|
||||
while (1)
|
||||
{
|
||||
rcount = 0;
|
||||
DWORD status;
|
||||
HANDLE handles[MAXIMUM_WAIT_OBJECTS] = { 0 };
|
||||
DWORD count = client->GetEventHandles(client, handles, ARRAYSIZE(handles));
|
||||
|
||||
if (client->GetFileDescriptor(client, rfds, &rcount) != TRUE)
|
||||
if (count == 0)
|
||||
{
|
||||
WLog_ERR(TAG, "Failed to get peer file descriptor");
|
||||
WLog_ERR(TAG, "Failed to get FreeRDP file descriptor");
|
||||
break;
|
||||
}
|
||||
|
||||
max_fds = 0;
|
||||
FD_ZERO(&rfds_set);
|
||||
|
||||
for (i = 0; i < rcount; i++)
|
||||
status = WaitForMultipleObjects(handles, count, FALSE, INFINITE);
|
||||
if (status == WAIT_FAILED)
|
||||
{
|
||||
fds = (int)(long)(rfds[i]);
|
||||
|
||||
if (fds > max_fds)
|
||||
max_fds = fds;
|
||||
|
||||
FD_SET(fds, &rfds_set);
|
||||
WLog_ERR(TAG, "WaitForMultipleObjects failed");
|
||||
break;
|
||||
}
|
||||
|
||||
if (max_fds == 0)
|
||||
break;
|
||||
|
||||
select(max_fds + 1, &rfds_set, NULL, NULL, NULL);
|
||||
SetEvent(context->socketEvent);
|
||||
WaitForSingleObject(context->socketSemaphore, INFINITE);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user