wfreerdp-server: improved peer tracking, added ability to disconnect individual peers

This commit is contained in:
Corey C 2012-10-08 15:46:01 -04:00
parent ecad702c98
commit 5d0a53a3b3
4 changed files with 12 additions and 4 deletions

View File

@ -206,7 +206,12 @@ void wf_info_peer_register(wfInfo* wfi, wfPeerContext* context)
int i;
int peerId;
//todo: reject peer if we have WF_INFO_MAXPEERS connected
if (wfi->peerCount == WF_INFO_MAXPEERS)
{
context->socketClose = TRUE;
wf_info_unlock(wfi);
return;
}
context->info = wfi;
context->updateEvent = CreateEvent(NULL, TRUE, FALSE, NULL);

View File

@ -23,7 +23,7 @@
#include "wf_interface.h"
#define WF_INFO_DEFAULT_FPS 24
#define WF_INFO_MAXPEERS 32
#define WF_INFO_MAXPEERS 2
int wf_info_lock(wfInfo* wfi);
int wf_info_try_lock(wfInfo* wfi, DWORD dwMilliseconds);

View File

@ -220,6 +220,9 @@ DWORD WINAPI wf_peer_main_loop(LPVOID lpParam)
client->Initialize(client);
context = (wfPeerContext*) client->context;
if (context->socketClose)
return 0;
wfi = context->info;
if (wfi->input_disabled == TRUE)

View File

@ -63,10 +63,10 @@ DWORD WINAPI wf_update_thread(LPVOID lpParam)
wf_update_encode(wfi);
//printf("Start of parallel sending\n");
index = 0;
for (peerindex = 0; peerindex < wfi->peerCount; peerindex++)
{
for (index = 0; index < WF_INFO_MAXPEERS; index++)
for (; index < WF_INFO_MAXPEERS; index++)
{
if (wfi->peers[index] && wfi->peers[index]->activated)
{