fix channel/smartcard: async request handling
authorBernhard Miklautz <bernhard.miklautz@thincast.com>
Mon, 4 Dec 2017 14:22:07 +0000 (15:22 +0100)
committerBernhard Miklautz <bernhard.miklautz@thincast.com>
Wed, 13 Dec 2017 16:04:06 +0000 (17:04 +0100)
commit46a7538322e1e02f6fb61f20d4a900756f673184
tree06f533180542b00bab8c398a3e37265b2dcb47e8
parent3dc4e283dbcf296cbd2648c9277e015ad4a74e71
fix channel/smartcard: async request handling

The smart card channel tried to mimic mstsc's behavior on if an IRP was
processed synchronously or asynchronously. As the channel uses one thread per
context it could happen, especially with PCSC, that the main
channel thread was blocked waiting for an smart card operation to
complete. To prevent that behavior only call known safe functions in the
main thread (like CreateContext) and call the rest asynchronously.

For example the channel would block if a ListReaders is invoked on
the same context where a GetStatusChange (infinite timeout)
was already pending. Only when a status change happened the channel
would continue.

Note: Due to the one context per thread design it's important that
cancel isn't queued an alway run synchronously. Otherwise a specific
context might lock.
channels/smartcard/client/smartcard_main.c