[Pcsclite-cvs-commit] r2180 - trunk/PCSC/src
Ludovic Rousseau
rousseau at costa.debian.org
Wed Sep 27 15:51:22 CEST 2006
Author: rousseau
Date: 2006-09-27 13:50:56 +0000 (Wed, 27 Sep 2006)
New Revision: 2180
Modified:
trunk/PCSC/src/winscard_svc.c
Log:
MSGRemoveContext(): Unlock the sharing so we do not get blocked in
SCardDisconnect() waiting forever
Modified: trunk/PCSC/src/winscard_svc.c
===================================================================
--- trunk/PCSC/src/winscard_svc.c 2006-09-27 13:36:39 UTC (rev 2179)
+++ trunk/PCSC/src/winscard_svc.c 2006-09-27 13:50:56 UTC (rev 2180)
@@ -31,6 +31,7 @@
#include "winscard_svc.h"
#include "sys_generic.h"
#include "thread_generic.h"
+#include "readerfactory.h"
/**
* @brief Represents the an Application Context on the Server side.
@@ -461,7 +462,6 @@
if (psContext[dwContextIndex].hContext == hContext)
{
-
for (i = 0; i < PCSCLITE_MAX_APPLICATION_CONTEXT_CHANNELS; i++)
{
/*
@@ -470,27 +470,36 @@
if (psContext[dwContextIndex].hCard[i] != 0)
{
+ PREADER_CONTEXT rContext = NULL;
/*
+ * Unlock the sharing
+ */
+ rv = RFReaderInfoById(psContext[dwContextIndex].hCard[i],
+ &rContext);
+ if (rv != SCARD_S_SUCCESS)
+ return rv;
+
+ rContext->dwLockId = 0;
+
+ /*
* We will use SCardStatus to see if the card has been
* reset there is no need to reset each time
* Disconnect is called
*/
- rv = SCardStatus(psContext[dwContextIndex].hCard[i], 0, 0, 0, 0, 0, 0);
+ rv = SCardStatus(psContext[dwContextIndex].hCard[i], NULL,
+ NULL, NULL, NULL, NULL, NULL);
- if (rv == SCARD_W_RESET_CARD
- || rv == SCARD_W_REMOVED_CARD)
- {
- SCardDisconnect(psContext[dwContextIndex].hCard[i], SCARD_LEAVE_CARD);
- } else
- {
- SCardDisconnect(psContext[dwContextIndex].hCard[i], SCARD_RESET_CARD);
- }
+ if (rv == SCARD_W_RESET_CARD || rv == SCARD_W_REMOVED_CARD)
+ SCardDisconnect(psContext[dwContextIndex].hCard[i],
+ SCARD_LEAVE_CARD);
+ else
+ SCardDisconnect(psContext[dwContextIndex].hCard[i],
+ SCARD_RESET_CARD);
psContext[dwContextIndex].hCard[i] = 0;
}
-
}
psContext[dwContextIndex].hContext = 0;
More information about the Pcsclite-cvs-commit
mailing list