Modified GetEventHandles of listener

Now using nCount as in and out argument.
When called, set nCount to the number of available handles.
This value is checked and an error returned, if not enough
handles are available.
This commit is contained in:
Armin Novak 2015-04-21 12:09:44 +02:00
parent 23dfec9cc1
commit 6e213bc61b
3 changed files with 6 additions and 2 deletions

View File

@ -258,11 +258,15 @@ static BOOL freerdp_listener_get_fds(freerdp_listener* instance, void** rfds, in
int freerdp_listener_get_event_handles(freerdp_listener* instance, HANDLE* events, DWORD* nCount)
{
int index;
DWORD count = *nCount;
rdpListener* listener = (rdpListener*) instance->listener;
if (listener->num_sockfds < 1)
return -1;
if (listener->num_sockfds > count)
return -1;
for (index = 0; index < listener->num_sockfds; index++)
{
events[*nCount] = listener->events[index];

View File

@ -744,7 +744,7 @@ static void test_server_mainloop(freerdp_listener* instance)
while (1)
{
count = 0;
count = 32;
if (instance->GetEventHandles(instance, handles, &count))
{

View File

@ -313,7 +313,7 @@ void* shadow_server_thread(rdpShadowServer* server)
while (1)
{
nCount = 0;
nCount = 32;
if (listener->GetEventHandles(listener, events, &nCount) < 0)
{