CVS: seamlessrdp/ServerExe vchannel.c,1.11,1.12

Pierre Ossman <[email protected]> Wed, 12 Jul 2006 05:01:59 -0700
Newsgroups gmane.network.rdesktop.cvs
Message-ID <[email protected]>
Update of /cvsroot/rdesktop/seamlessrdp/ServerExe
In directory sc8-pr-cvs9.sourceforge.net:/tmp/cvs-serv26133/ServerExe

Modified Files:
	vchannel.c 
Log Message:
Add some simple reference counting for vchannel_open()/close() as it might
be done multple times as seamlessrdp.dll hooks into seamlessrdpshell.exe.


Index: vchannel.c
===================================================================
RCS file: /cvsroot/rdesktop/seamlessrdp/ServerExe/vchannel.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** vchannel.c	20 Mar 2006 10:30:25 -0000	1.11
--- vchannel.c	12 Jul 2006 12:01:56 -0000	1.12
***************
*** 53,56 ****
--- 53,57 ----
  static HANDLE g_mutex = NULL;
  static HANDLE g_vchannel = NULL;
+ static unsigned int g_opencount = 0;
  
  DLL_EXPORT void
***************
*** 120,123 ****
--- 121,128 ----
  vchannel_open()
  {
+ 	g_opencount++;
+ 	if (g_opencount > 1)
+ 		return 0;
+ 
  	g_vchannel = WTSVirtualChannelOpen(WTS_CURRENT_SERVER_HANDLE,
  					   WTS_CURRENT_SESSION, CHANNELNAME);
***************
*** 140,143 ****
--- 145,152 ----
  vchannel_close()
  {
+ 	g_opencount--;
+ 	if (g_opencount > 0)
+ 		return;
+ 
  	if (g_mutex)
  		CloseHandle(g_mutex);



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642