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

Ludovic Rousseau rousseau at alioth.debian.org
Tue Mar 13 09:10:25 CET 2007


Author: rousseau
Date: 2007-03-13 08:10:25 +0000 (Tue, 13 Mar 2007)
New Revision: 2475

Modified:
   trunk/PCSC/src/winscard_clnt.c
Log:
SCardReconnect(): block instead of returning SCARD_E_SHARING_VIOLATION


Modified: trunk/PCSC/src/winscard_clnt.c
===================================================================
--- trunk/PCSC/src/winscard_clnt.c	2007-03-12 10:39:29 UTC (rev 2474)
+++ trunk/PCSC/src/winscard_clnt.c	2007-03-13 08:10:25 UTC (rev 2475)
@@ -866,34 +866,37 @@
 		return SCARD_E_READER_UNAVAILABLE;
 	}
 
-	scReconnectStruct.hCard = hCard;
-	scReconnectStruct.dwShareMode = dwShareMode;
-	scReconnectStruct.dwPreferredProtocols = dwPreferredProtocols;
-	scReconnectStruct.dwInitialization = dwInitialization;
-	scReconnectStruct.pdwActiveProtocol = *pdwActiveProtocol;
+	do
+	{
+		scReconnectStruct.hCard = hCard;
+		scReconnectStruct.dwShareMode = dwShareMode;
+		scReconnectStruct.dwPreferredProtocols = dwPreferredProtocols;
+		scReconnectStruct.dwInitialization = dwInitialization;
+		scReconnectStruct.pdwActiveProtocol = *pdwActiveProtocol;
 
-	rv = WrapSHMWrite(SCARD_RECONNECT, psContextMap[dwContextIndex].dwClientID,
-		sizeof(scReconnectStruct),
-		PCSCLITE_CLIENT_ATTEMPTS, (void *) &scReconnectStruct);
+		rv = WrapSHMWrite(SCARD_RECONNECT, psContextMap[dwContextIndex].dwClientID,
+			sizeof(scReconnectStruct),
+			PCSCLITE_CLIENT_ATTEMPTS, (void *) &scReconnectStruct);
 
-	if (rv == -1)
-	{
-		SYS_MutexUnLock(psContextMap[dwContextIndex].mMutex);
-		return SCARD_E_NO_SERVICE;
-	}
+		if (rv == -1)
+		{
+			SYS_MutexUnLock(psContextMap[dwContextIndex].mMutex);
+			return SCARD_E_NO_SERVICE;
+		}
 
-	/*
-	 * Read a message from the server
-	 */
-	rv = SHMClientRead(&msgStruct, psContextMap[dwContextIndex].dwClientID, PCSCLITE_CLIENT_ATTEMPTS);
+		/*
+		 * Read a message from the server
+		 */
+		rv = SHMClientRead(&msgStruct, psContextMap[dwContextIndex].dwClientID, PCSCLITE_CLIENT_ATTEMPTS);
 
-	memcpy(&scReconnectStruct, &msgStruct.data, sizeof(scReconnectStruct));
+		memcpy(&scReconnectStruct, &msgStruct.data, sizeof(scReconnectStruct));
 
-	if (rv == -1)
-	{
-		SYS_MutexUnLock(psContextMap[dwContextIndex].mMutex);
-		return SCARD_F_COMM_ERROR;
-	}
+		if (rv == -1)
+		{
+			SYS_MutexUnLock(psContextMap[dwContextIndex].mMutex);
+			return SCARD_F_COMM_ERROR;
+		}
+	} while (SCARD_E_SHARING_VIOLATION == scReconnectStruct.rv);
 
 	*pdwActiveProtocol = scReconnectStruct.pdwActiveProtocol;
 




More information about the Pcsclite-cvs-commit mailing list