Hello Damien, hello, List,

I'm also trying to use PCSC lite with parallel multiple readers
and I'm also getting some problems with the pcscd daemon.

I'm testing pcsc-lite version 1.2.0-rc1 with 5 CardMan 2020 readers,
using the Omnikey driver libcm2020.so version 2.3.2beta4.

My test program is an infinite cycle of file reads. The file is ca.
1.5 Kbyte big. I use one process per reader.

I configured pcsc-lite to use pthread and tried out both options
--enable-threadsafe and --disable-threadsafe.

At first try the pcscd daemon only managed 2 readers.
The other 3 clients died after a timeout in SCardEstablishContext.

It turned out that the pcscd daemon had put them to sleep until it
was ready with the first two clients, but since these were very
"greedy" due to the heavy load file read operations, the daemon
waited until the first two processes were stopped and only then
tried to communicate with the others, finding out they were died
in the meantime. All it could do then was to close their contexts.

This only happened with heavy load clients, not using testpcsc
as a test program.

I solved this problem by a slight modification of the function
SHMProcessEvents in winscard_msg.c (patch file is attached).

Now all 5 readers are communicating with the pcscd daemon,
but they are doing that in turn!
This is bad, since the whole purpose of using multiple readers
for me is to speed up heavy load operations like RSA signature
or reading out X.509 certificates.

Is there a way to get the readers to really work simultaneously?


Regards Bettina Martelli

--
Dr. Bettina Martelli, Development, TC TrustCenter AG
Sonninstra�e 24-28,  D-20097 Hamburg,  Germany
Tel: +49 (0)40 / 80 80 26-0 Fax: +49 (0)40 / 80 80 26-126
214,215c214
<       static int last_client;
<       int i, j, selret, largeSock, rv;
---
>       int i, selret, largeSock, rv;
267d265
<                       DebugLogA("SHMProcessEvents: Common channel packet arrival: 
return -1");
271d268
<                       DebugLogA("SHMProcessEvents: Common channel packet arrival: 
return 0");
275,277c272,273
<         // Start each time with the last client and go round, else
<         // in case of much traffic only two clients will be serviced
<       for (j = 0; j < PCSCLITE_MAX_APPLICATIONS; j++)
---
> 
>       for (i = 0; i < PCSCLITE_MAX_APPLICATIONS; i++)
279d274
<               i=(j+last_client)%PCSCLITE_MAX_APPLICATIONS;
303,304d297
<                               last_client=i;
<                               DebugLogB("SHMProcessEvents: correctly processed for 
client %d", last_client);

Reply via email to