Hello,
I'm going to make a new release of pcsc-lite this week. This one will do a
better job of maintaining state when a client dies unexpectedly.
The current problem with 0.4.0 is when a client calls SCardConnect() and
then SIGINT's or dies unexpectedly the connection is still retained on the
server.
Since there is no clean way in RPC to determine whether or not a client is
alive or not without opening a socket on the client and threading it (BAD)
I have noticed a few things. When an RPC call comes in at the server it
passes a svc_req structure which holds port information, file
descriptors/etc. For each connection that comes in it gets a unique file
descriptor associated with it. When a connection dies the operating system
recycles the file descriptor. So ( this is a bit ugly ) I am looking to
see one of 2 things:
1) If the current file descriptor matches one on the client connections stack
then the connection on the stack must have died and resources can be
cleaned up by calling SCardDisconnect() etc. This works when
connections
die in a serial manner.
2) Otherwise use the function fstat to determine whether a file descriptor is
valid or not. This is helpful when 2 or more connections die at the
same time or multiple connections die unexpectedly before another tries
to establish.
Please let me know if this sounds discusting to you. It seems to work and
make the server much more robust and able to handle many more unforseen
circumstances. This will be released with the built in Timeout function
and the Makefile that will work for BSD later this week.
Best Regards,
Dave
David Corcoran Purdue University
1008 Cherry Lane MUSCLE Smartcard Developers
West Lafayette, IN 47906 http://www.linuxnet.com
765-463-0096 765-427-5147 cellular
***************************************************************
Linux Smart Card Developers - M.U.S.C.L.E.
(Movement for the Use of Smart Cards in a Linux Environment)
http://www.linuxnet.com/smartcard/index.html
***************************************************************