server/smartcard: don't push our own error on reader add

The device already sends one. There are actually two connections going
on:
 server to client - this is the smartcard channel, it reuses the VSC protocol.
 server to device - this is an internal connection using VSC too.

We generally just passthrough all messages from the client to the device,
and from the device to the client. We only rewrite the reader_id because
the device knows about a single id (it is actually a card id), and we
may manage more then one in the future.

Bottom line is that there was an extra VSC_Error message reaching the client.
This commit is contained in:
Alon Levy 2011-02-09 12:09:43 +02:00
parent 91bf99a1e9
commit 51da06793c

View File

@ -393,12 +393,12 @@ static void smartcard_add_reader(SmartCardChannel *smartcard_channel, uint8_t *n
// TODO - save name somewhere
SpiceCharDeviceInstance *char_device =
smartcard_readers_get_unattached();
SmartCardDeviceState *state;
if (char_device != NULL) {
state = SPICE_CONTAINEROF(char_device->st, SmartCardDeviceState, base);
smartcard_char_device_attach(char_device, smartcard_channel);
smartcard_push_error(smartcard_channel, state->reader_id, VSC_SUCCESS);
// The device sends a VSC_Error message, we will let it through, no
// need to send our own. We already set the correct reader_id, from
// our SmartCardDeviceState.
} else {
smartcard_push_error(smartcard_channel, VSCARD_UNDEFINED_READER_ID,
VSC_CANNOT_ADD_MORE_READERS);