[Pcsclite-cvs-commit] r2374 - trunk/PCSC/src

Ludovic Rousseau rousseau at alioth.debian.org
Mon Feb 5 10:41:09 CET 2007


Author: rousseau
Date: 2007-02-05 10:41:09 +0100 (Mon, 05 Feb 2007)
New Revision: 2374

Modified:
   trunk/PCSC/src/winscard.c
   trunk/PCSC/src/winscard_clnt.c
Log:
SCardBeginTransaction() client and server side: call SYS_USleep() on the
server side insead of client side and only if needed.
SCardBeginTransaction() will be much faster


Modified: trunk/PCSC/src/winscard.c
===================================================================
--- trunk/PCSC/src/winscard.c	2007-02-05 09:38:30 UTC (rev 2373)
+++ trunk/PCSC/src/winscard.c	2007-02-05 09:41:09 UTC (rev 2374)
@@ -1002,6 +1002,8 @@
 		return rv;
 
 	rv = RFLockSharing(hCard);
+	if (SCARD_E_SHARING_VIOLATION == rv)
+		SYS_USleep(100000);
 
 	Log2(PCSC_LOG_DEBUG, "Status: 0x%08X", rv);
 

Modified: trunk/PCSC/src/winscard_clnt.c
===================================================================
--- trunk/PCSC/src/winscard_clnt.c	2007-02-05 09:38:30 UTC (rev 2373)
+++ trunk/PCSC/src/winscard_clnt.c	2007-02-05 09:41:09 UTC (rev 2374)
@@ -1066,30 +1066,6 @@
 
 	do
 	{
-		/*
-		 * Look to see if it is locked before polling the server for
-		 * admission to the readers resources
-		 */
-		if ((readerStates[i])->lockState != 0)
-		{
-			int randnum = 0;
-			int j;
-
-			for (j = 0; j < 100; j++)
-			{
-				/*
-				 * This helps prevent starvation
-				 */
-				randnum = SYS_RandomInt(1000, 10000);
-				SYS_USleep(randnum);
-
-				if ((readerStates[i])->lockState == 0)
-				{
-					break;
-				}
-			}
-		}
-
 		rv = WrapSHMWrite(SCARD_BEGIN_TRANSACTION, psContextMap[dwContextIndex].dwClientID,
 			sizeof(scBeginStruct),
 			PCSCLITE_CLIENT_ATTEMPTS, (void *) &scBeginStruct);




More information about the Pcsclite-cvs-commit mailing list