- After implementing SCARD_AUTOALLOCATE functionality for getting card
readers name, the deletion of the allocated memory in
`PCSCLite:: HandleReaderStatusChange` was not correctly migrated and
was causing serious issues in `Windows`.
- See: https://github.com/santigimeno/node-pcsclite/issues/45.
- Use SCARD_AUTOALLOCATE if available. It avoids one extra call to
SCardListReaders.
- If it's not available handle SCARD_E_INSUFFICIENT_BUFFER error by
retrying get_card_readers.
- Avoid sending twice the same status.
- Discard SCARD_E_UNKNOWN_READER error as it's happening when the reader is
disconnected and the disconnection will be detected by the pcsclite.cpp
status thread.
- Allow up to 4 the number of times SCardCancel is called before waiting for
the status `thread` to finish.
- Destroy the mutexes and conds only in the destructors.
- Check that the thread handles are still valid before calling join on them.
- A reader disconnection can't be detected by SCardGetStatusChange in the reader
(cardreader.cpp) but by detecting that the reader doesn't appear in the list of
readers retrieved in pcsclite.cpp.
- The list of readers is now stored in an object where the keys are the names of
the readers. When a reader disconnection is detected, the reader is closed
triggering the 'end' event. Then the reader is removed from the readers list.
- Make sure while handling AsyncResult in HandleReaderStatusChange
(JS thread), the AsyncResult is not overwritten in HandlerFunction
(SCardGetStatusChange thread).
Since version 0.4.0 of node-pcsclite all systems Linux, Mac OS X and
Windows are supported.
The wrapper is no more limited to pcsclite but to any implementation of
PC/SC.
- So it can be compatible in every platform supported by libuv.
- Use attached threads instead of detached.
- Remove all CardReader 'status' listeners before emitting the
'end' event.
- Remove SCardEstablishContext from get_card_readers.
- Initialize m_status_thread to NULL so calling PCSCLite destructor does not
crash in case the thread has not been launched. For example when
SCardEstablish context fails
- Thanks to Ludovic Rousseau for pointing that out @
https://github.com/santigimeno/node-pcsclite/pull/15#issuecomment-56222251.