mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2025-06-03 00:00:20 +00:00
wfreerdp-server: generalized managed api callbacks, peer tracking bug fixes, code cleanup
This commit is contained in:
parent
5d0a53a3b3
commit
36394b3c23
@ -1,21 +1,21 @@
|
|||||||
/**
|
/**
|
||||||
* FreeRDP: A Remote Desktop Protocol Client
|
* FreeRDP: A Remote Desktop Protocol Client
|
||||||
* FreeRDP Windows Server
|
* FreeRDP Windows Server
|
||||||
*
|
*
|
||||||
* Copyright 2012 Corey Clayton <can.of.tuna@gmail.com>
|
* Copyright 2012 Corey Clayton <can.of.tuna@gmail.com>
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
* You may obtain a copy of the License at
|
* You may obtain a copy of the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -41,19 +41,19 @@ int wf_info_lock(wfInfo* wfi)
|
|||||||
|
|
||||||
switch (dRes)
|
switch (dRes)
|
||||||
{
|
{
|
||||||
case WAIT_ABANDONED:
|
case WAIT_ABANDONED:
|
||||||
case WAIT_OBJECT_0:
|
case WAIT_OBJECT_0:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WAIT_TIMEOUT:
|
case WAIT_TIMEOUT:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WAIT_FAILED:
|
case WAIT_FAILED:
|
||||||
printf("wf_info_lock failed with 0x%08X\n", GetLastError());
|
printf("wf_info_lock failed with 0x%08X\n", GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
@ -67,19 +67,19 @@ int wf_info_try_lock(wfInfo* wfi, DWORD dwMilliseconds)
|
|||||||
|
|
||||||
switch (dRes)
|
switch (dRes)
|
||||||
{
|
{
|
||||||
case WAIT_ABANDONED:
|
case WAIT_ABANDONED:
|
||||||
case WAIT_OBJECT_0:
|
case WAIT_OBJECT_0:
|
||||||
return TRUE;
|
return TRUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WAIT_TIMEOUT:
|
case WAIT_TIMEOUT:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WAIT_FAILED:
|
case WAIT_FAILED:
|
||||||
printf("wf_info_try_lock failed with 0x%08X\n", GetLastError());
|
printf("wf_info_try_lock failed with 0x%08X\n", GetLastError());
|
||||||
return -1;
|
return -1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return -1;
|
return -1;
|
||||||
@ -100,7 +100,7 @@ wfInfo* wf_info_init()
|
|||||||
{
|
{
|
||||||
wfInfo* wfi;
|
wfInfo* wfi;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
OSVERSIONINFOEX osvi;
|
OSVERSIONINFOEX osvi;
|
||||||
SYSTEM_INFO si;
|
SYSTEM_INFO si;
|
||||||
BOOL bOsVersionInfoEx;
|
BOOL bOsVersionInfoEx;
|
||||||
@ -175,15 +175,15 @@ wfInfo* wf_info_init()
|
|||||||
wfi->win8 = FALSE;
|
wfi->win8 = FALSE;
|
||||||
if(bOsVersionInfoEx != 0 )
|
if(bOsVersionInfoEx != 0 )
|
||||||
{
|
{
|
||||||
if ( VER_PLATFORM_WIN32_NT==osvi.dwPlatformId &&
|
if ( VER_PLATFORM_WIN32_NT==osvi.dwPlatformId &&
|
||||||
osvi.dwMajorVersion > 4 )
|
osvi.dwMajorVersion > 4 )
|
||||||
{
|
{
|
||||||
if ( osvi.dwMajorVersion == 6 &&
|
if ( osvi.dwMajorVersion == 6 &&
|
||||||
osvi.dwMinorVersion == 2)
|
osvi.dwMinorVersion == 2)
|
||||||
{
|
{
|
||||||
wfi->win8 = TRUE;
|
wfi->win8 = TRUE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
@ -205,7 +205,6 @@ void wf_info_peer_register(wfInfo* wfi, wfPeerContext* context)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
int peerId;
|
int peerId;
|
||||||
//todo: reject peer if we have WF_INFO_MAXPEERS connected
|
|
||||||
if (wfi->peerCount == WF_INFO_MAXPEERS)
|
if (wfi->peerCount == WF_INFO_MAXPEERS)
|
||||||
{
|
{
|
||||||
context->socketClose = TRUE;
|
context->socketClose = TRUE;
|
||||||
@ -240,7 +239,7 @@ void wf_info_peer_register(wfInfo* wfi, wfPeerContext* context)
|
|||||||
|
|
||||||
wf_info_unlock(wfi);
|
wf_info_unlock(wfi);
|
||||||
|
|
||||||
wfreerdp_server_peer_connect_event(peerId);
|
wfreerdp_server_peer_callback_event(peerId, WF_SRV_CALLBACK_EVENT_CONNECT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -264,7 +263,7 @@ void wf_info_peer_unregister(wfInfo* wfi, wfPeerContext* context)
|
|||||||
|
|
||||||
wf_info_unlock(wfi);
|
wf_info_unlock(wfi);
|
||||||
|
|
||||||
wfreerdp_server_peer_disconnect_event(peerId);
|
wfreerdp_server_peer_callback_event(peerId, WF_SRV_CALLBACK_EVENT_DISCONNECT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
#include "wf_interface.h"
|
#include "wf_interface.h"
|
||||||
|
|
||||||
#define WF_INFO_DEFAULT_FPS 24
|
#define WF_INFO_DEFAULT_FPS 24
|
||||||
#define WF_INFO_MAXPEERS 2
|
#define WF_INFO_MAXPEERS 32
|
||||||
|
|
||||||
int wf_info_lock(wfInfo* wfi);
|
int wf_info_lock(wfInfo* wfi);
|
||||||
int wf_info_try_lock(wfInfo* wfi, DWORD dwMilliseconds);
|
int wf_info_try_lock(wfInfo* wfi, DWORD dwMilliseconds);
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
* FreeRDP Windows Server
|
* FreeRDP Windows Server
|
||||||
*
|
*
|
||||||
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||||
|
* Copyright 2012 Corey Clayton <can.of.tuna@gmail.com>
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@ -25,6 +26,8 @@
|
|||||||
#include <winpr/tchar.h>
|
#include <winpr/tchar.h>
|
||||||
#include <winpr/windows.h>
|
#include <winpr/windows.h>
|
||||||
#include <freerdp/utils/tcp.h>
|
#include <freerdp/utils/tcp.h>
|
||||||
|
#include <freerdp\listener.h>
|
||||||
|
//#include <libfreerdp\core\listener.h>
|
||||||
|
|
||||||
#include "wf_peer.h"
|
#include "wf_peer.h"
|
||||||
#include "wf_settings.h"
|
#include "wf_settings.h"
|
||||||
@ -32,18 +35,7 @@
|
|||||||
|
|
||||||
#include "wf_interface.h"
|
#include "wf_interface.h"
|
||||||
|
|
||||||
//todo: remove this
|
cbCallback cbEvent;
|
||||||
struct rdp_listener
|
|
||||||
{
|
|
||||||
freerdp_listener* instance;
|
|
||||||
|
|
||||||
int sockfds[5];
|
|
||||||
int num_sockfds;
|
|
||||||
};
|
|
||||||
//
|
|
||||||
|
|
||||||
cbConEvent cbConnect;
|
|
||||||
cbConEvent cbDisconnect;
|
|
||||||
|
|
||||||
DWORD WINAPI wf_server_main_loop(LPVOID lpParam)
|
DWORD WINAPI wf_server_main_loop(LPVOID lpParam)
|
||||||
{
|
{
|
||||||
@ -53,7 +45,6 @@ DWORD WINAPI wf_server_main_loop(LPVOID lpParam)
|
|||||||
void* rfds[32];
|
void* rfds[32];
|
||||||
fd_set rfds_set;
|
fd_set rfds_set;
|
||||||
freerdp_listener* instance;
|
freerdp_listener* instance;
|
||||||
struct rdp_listener* listener;
|
|
||||||
wfInfo* wfi;
|
wfInfo* wfi;
|
||||||
|
|
||||||
wfi = wf_info_get_instance();
|
wfi = wf_info_get_instance();
|
||||||
@ -61,9 +52,8 @@ DWORD WINAPI wf_server_main_loop(LPVOID lpParam)
|
|||||||
|
|
||||||
ZeroMemory(rfds, sizeof(rfds));
|
ZeroMemory(rfds, sizeof(rfds));
|
||||||
instance = (freerdp_listener*) lpParam;
|
instance = (freerdp_listener*) lpParam;
|
||||||
listener = (struct rdp_listener*) instance->listener;
|
|
||||||
|
|
||||||
while (listener->num_sockfds > 0)
|
while(wfi->force_all_disconnect == FALSE)
|
||||||
{
|
{
|
||||||
rcount = 0;
|
rcount = 0;
|
||||||
|
|
||||||
@ -151,8 +141,7 @@ wfServer* wfreerdp_server_new()
|
|||||||
server->port = 3389;
|
server->port = 3389;
|
||||||
}
|
}
|
||||||
|
|
||||||
cbConnect = NULL;
|
cbEvent = NULL;
|
||||||
cbDisconnect = NULL;
|
|
||||||
|
|
||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
@ -212,7 +201,7 @@ FREERDP_API UINT32 wfreerdp_server_get_peer_hostname(int pId, wchar_t * dstStr)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("nonexistent peer\n");
|
printf("nonexistent peer id=%d\n", pId);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -293,25 +282,14 @@ FREERDP_API BOOL wfreerdp_server_peer_is_authenticated(int pId)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FREERDP_API void wfreerdp_server_register_connect_event(cbConEvent cb)
|
FREERDP_API void wfreerdp_server_register_callback_event(cbCallback cb)
|
||||||
{
|
{
|
||||||
cbConnect = cb;
|
cbEvent = cb;
|
||||||
}
|
}
|
||||||
|
|
||||||
FREERDP_API void wfreerdp_server_register_disconnect_event(cbConEvent cb)
|
void wfreerdp_server_peer_callback_event(int pId, UINT32 eType)
|
||||||
{
|
{
|
||||||
cbDisconnect = cb;
|
if (cbEvent)
|
||||||
}
|
cbEvent(pId, eType);
|
||||||
|
|
||||||
|
|
||||||
void wfreerdp_server_peer_connect_event(int pId)
|
|
||||||
{
|
|
||||||
if (cbConnect)
|
|
||||||
cbConnect(pId);
|
|
||||||
}
|
|
||||||
void wfreerdp_server_peer_disconnect_event(int pId)
|
|
||||||
{
|
|
||||||
if (cbDisconnect)
|
|
||||||
cbDisconnect(pId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
/**
|
/**
|
||||||
* FreeRDP: A Remote Desktop Protocol Client
|
* FreeRDP: A Remote Desktop Protocol Client
|
||||||
* FreeRDP Windows Server
|
* FreeRDP Windows Server
|
||||||
*
|
*
|
||||||
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||||
*
|
* Copyright 2012 Corey Clayton <can.of.tuna@gmail.com>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
*
|
||||||
* you may not use this file except in compliance with the License.
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* You may obtain a copy of the License at
|
* you may not use this file except in compliance with the License.
|
||||||
*
|
* You may obtain a copy of the License at
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
*
|
||||||
*
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
*
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* See the License for the specific language governing permissions and
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* limitations under the License.
|
* See the License for the specific language governing permissions and
|
||||||
*/
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef WF_INTERFACE_H
|
#ifndef WF_INTERFACE_H
|
||||||
#define WF_INTERFACE_H
|
#define WF_INTERFACE_H
|
||||||
@ -29,6 +30,11 @@
|
|||||||
#include <freerdp/freerdp.h>
|
#include <freerdp/freerdp.h>
|
||||||
#include <freerdp/codec/rfx.h>
|
#include <freerdp/codec/rfx.h>
|
||||||
|
|
||||||
|
#define WF_SRV_CALLBACK_EVENT_CONNECT 1
|
||||||
|
#define WF_SRV_CALLBACK_EVENT_DISCONNECT 2
|
||||||
|
#define WF_SRV_CALLBACK_EVENT_ACTIVATE 4
|
||||||
|
#define WF_SRV_CALLBACK_EVENT_AUTH 8
|
||||||
|
|
||||||
typedef struct wf_info wfInfo;
|
typedef struct wf_info wfInfo;
|
||||||
typedef struct wf_peer_context wfPeerContext;
|
typedef struct wf_peer_context wfPeerContext;
|
||||||
|
|
||||||
@ -86,7 +92,7 @@ struct wf_server
|
|||||||
};
|
};
|
||||||
typedef struct wf_server wfServer;
|
typedef struct wf_server wfServer;
|
||||||
|
|
||||||
typedef void (__stdcall* cbConEvent) (int);
|
typedef void (__stdcall* cbCallback) (int, UINT32);
|
||||||
|
|
||||||
FREERDP_API BOOL wfreerdp_server_start(wfServer* server);
|
FREERDP_API BOOL wfreerdp_server_start(wfServer* server);
|
||||||
FREERDP_API BOOL wfreerdp_server_stop(wfServer* server);
|
FREERDP_API BOOL wfreerdp_server_stop(wfServer* server);
|
||||||
@ -103,10 +109,13 @@ FREERDP_API BOOL wfreerdp_server_peer_is_connected(int pId);
|
|||||||
FREERDP_API BOOL wfreerdp_server_peer_is_activated(int pId);
|
FREERDP_API BOOL wfreerdp_server_peer_is_activated(int pId);
|
||||||
FREERDP_API BOOL wfreerdp_server_peer_is_authenticated(int pId);
|
FREERDP_API BOOL wfreerdp_server_peer_is_authenticated(int pId);
|
||||||
|
|
||||||
FREERDP_API void wfreerdp_server_register_connect_event(cbConEvent cb);
|
//FREERDP_API void wfreerdp_server_register_connect_event(cbConEvent cb);
|
||||||
FREERDP_API void wfreerdp_server_register_disconnect_event(cbConEvent cb);
|
//FREERDP_API void wfreerdp_server_register_disconnect_event(cbConEvent cb);
|
||||||
|
FREERDP_API void wfreerdp_server_register_callback_event(cbCallback cb);
|
||||||
|
|
||||||
void wfreerdp_server_peer_connect_event(int pId);
|
//void wfreerdp_server_peer_connect_event(int pId);
|
||||||
void wfreerdp_server_peer_disconnect_event(int pId);
|
//void wfreerdp_server_peer_disconnect_event(int pId);
|
||||||
|
|
||||||
|
void wfreerdp_server_peer_callback_event(int pId, UINT32 eType);
|
||||||
|
|
||||||
#endif /* WF_INTERFACE_H */
|
#endif /* WF_INTERFACE_H */
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
/**
|
/**
|
||||||
* FreeRDP: A Remote Desktop Protocol Client
|
* FreeRDP: A Remote Desktop Protocol Client
|
||||||
* FreeRDP Windows Server
|
* FreeRDP Windows Server
|
||||||
*
|
*
|
||||||
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||||
*
|
* Copyright 2012 Corey Clayton <can.of.tuna@gmail.com>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
*
|
||||||
* you may not use this file except in compliance with the License.
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* You may obtain a copy of the License at
|
* you may not use this file except in compliance with the License.
|
||||||
*
|
* You may obtain a copy of the License at
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
*
|
||||||
*
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
*
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* See the License for the specific language governing permissions and
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* limitations under the License.
|
* See the License for the specific language governing permissions and
|
||||||
*/
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -53,7 +54,7 @@ void wf_peer_init(freerdp_peer* client)
|
|||||||
client->context_size = sizeof(wfPeerContext);
|
client->context_size = sizeof(wfPeerContext);
|
||||||
client->ContextNew = (psPeerContextNew) wf_peer_context_new;
|
client->ContextNew = (psPeerContextNew) wf_peer_context_new;
|
||||||
client->ContextFree = (psPeerContextFree) wf_peer_context_free;
|
client->ContextFree = (psPeerContextFree) wf_peer_context_free;
|
||||||
|
|
||||||
freerdp_peer_context_new(client);
|
freerdp_peer_context_new(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -92,13 +93,15 @@ boolean wf_peer_activate(freerdp_peer* client)
|
|||||||
{
|
{
|
||||||
wfInfo* wfi;
|
wfInfo* wfi;
|
||||||
wfPeerContext* context = (wfPeerContext*) client->context;
|
wfPeerContext* context = (wfPeerContext*) client->context;
|
||||||
|
|
||||||
printf("PeerActivate\n");
|
printf("PeerActivate\n");
|
||||||
|
|
||||||
wfi = context->info;
|
wfi = context->info;
|
||||||
client->activated = true;
|
client->activated = true;
|
||||||
wf_update_peer_activate(wfi, context);
|
wf_update_peer_activate(wfi, context);
|
||||||
|
|
||||||
|
wfreerdp_server_peer_callback_event(((rdpContext*) context)->peer->pId, WF_SRV_CALLBACK_EVENT_ACTIVATE);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,6 +115,8 @@ boolean wf_peer_logon(freerdp_peer* client, SEC_WINNT_AUTH_IDENTITY* identity, b
|
|||||||
identity->User, identity->Domain, identity->Password);
|
identity->User, identity->Domain, identity->Password);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wfreerdp_server_peer_callback_event(((rdpContext*) client->context)->peer->pId, WF_SRV_CALLBACK_EVENT_AUTH);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -162,10 +167,10 @@ DWORD WINAPI wf_peer_socket_listener(LPVOID lpParam)
|
|||||||
|
|
||||||
FD_SET(fds, &rfds_set);
|
FD_SET(fds, &rfds_set);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (max_fds == 0)
|
if (max_fds == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
select(max_fds + 1, &rfds_set, NULL, NULL, NULL);
|
select(max_fds + 1, &rfds_set, NULL, NULL, NULL);
|
||||||
|
|
||||||
SetEvent(context->socketEvent);
|
SetEvent(context->socketEvent);
|
||||||
|
@ -1,21 +1,22 @@
|
|||||||
/**
|
/**
|
||||||
* FreeRDP: A Remote Desktop Protocol Client
|
* FreeRDP: A Remote Desktop Protocol Client
|
||||||
* FreeRDP Windows Server
|
* FreeRDP Windows Server
|
||||||
*
|
*
|
||||||
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
* Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
|
||||||
*
|
* Copyright 2012 Corey Clayton <can.of.tuna@gmail.com>
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
*
|
||||||
* you may not use this file except in compliance with the License.
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* You may obtain a copy of the License at
|
* you may not use this file except in compliance with the License.
|
||||||
*
|
* You may obtain a copy of the License at
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
*
|
||||||
*
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
*
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* See the License for the specific language governing permissions and
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* limitations under the License.
|
* See the License for the specific language governing permissions and
|
||||||
*/
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H
|
#ifdef HAVE_CONFIG_H
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
@ -74,7 +75,7 @@ DWORD WINAPI wf_update_thread(LPVOID lpParam)
|
|||||||
SetEvent(((wfPeerContext*) wfi->peers[index]->context)->updateEvent);
|
SetEvent(((wfPeerContext*) wfi->peers[index]->context)->updateEvent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
for (index = 0; index < wfi->activePeerCount; index++)
|
for (index = 0; index < wfi->activePeerCount; index++)
|
||||||
@ -109,12 +110,12 @@ DWORD WINAPI wf_update_thread(LPVOID lpParam)
|
|||||||
|
|
||||||
void wf_update_encode(wfInfo* wfi)
|
void wf_update_encode(wfInfo* wfi)
|
||||||
{
|
{
|
||||||
|
|
||||||
RFX_RECT rect;
|
RFX_RECT rect;
|
||||||
long height, width;
|
long height, width;
|
||||||
uint8* pDataBits = NULL;
|
uint8* pDataBits = NULL;
|
||||||
int stride;
|
int stride;
|
||||||
|
|
||||||
SURFACE_BITS_COMMAND* cmd;
|
SURFACE_BITS_COMMAND* cmd;
|
||||||
|
|
||||||
wf_info_find_invalid_region(wfi);
|
wf_info_find_invalid_region(wfi);
|
||||||
@ -133,7 +134,7 @@ void wf_update_encode(wfInfo* wfi)
|
|||||||
//printf("x:%d y:%d w:%d h:%d\n", wfi->invalid.left, wfi->invalid.top, width, height);
|
//printf("x:%d y:%d w:%d h:%d\n", wfi->invalid.left, wfi->invalid.top, width, height);
|
||||||
|
|
||||||
rfx_compose_message(wfi->rfx_context, wfi->s, &rect, 1,
|
rfx_compose_message(wfi->rfx_context, wfi->s, &rect, 1,
|
||||||
pDataBits, width, height, stride);
|
pDataBits, width, height, stride);
|
||||||
|
|
||||||
wfi->frame_idx = wfi->rfx_context->frame_idx;
|
wfi->frame_idx = wfi->rfx_context->frame_idx;
|
||||||
|
|
||||||
@ -160,10 +161,10 @@ void wf_update_peer_send(wfInfo* wfi, wfPeerContext* context)
|
|||||||
context->frame_idx = 0;
|
context->frame_idx = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* When a new client connects, it is possible that old frames from
|
* When a new client connects, it is possible that old frames from
|
||||||
* from a previous encoding state remain. Those frames should be discarded
|
* from a previous encoding state remain. Those frames should be discarded
|
||||||
* as they will cause an error condition in mstsc.
|
* as they will cause an error condition in mstsc.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ((context->frame_idx + 1) != wfi->frame_idx)
|
if ((context->frame_idx + 1) != wfi->frame_idx)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user