d4cdad5
From 01936dfd5b9fa8117fc1d63ce92198dd28422773 Mon Sep 17 00:00:00 2001
d4cdad5
From: Hans de Goede <hdegoede@redhat.com>
d4cdad5
Date: Mon, 19 Dec 2011 14:59:45 +0100
d4cdad5
Subject: [PATCH 101/118] usb-redir: Clear iso / irq error when stopping the
d4cdad5
 stream
d4cdad5
d4cdad5
And ignore status messages from the client which arrive after stream
d4cdad5
stop (the stream stop send to the client and an error status reported by
d4cdad5
the client my cross each other due to network latency).
d4cdad5
d4cdad5
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
d4cdad5
---
d4cdad5
 usb-redir.c |    6 ++++--
d4cdad5
 1 files changed, 4 insertions(+), 2 deletions(-)
d4cdad5
d4cdad5
diff --git a/usb-redir.c b/usb-redir.c
d4cdad5
index fb91c92..7678f1a 100644
d4cdad5
--- a/usb-redir.c
d4cdad5
+++ b/usb-redir.c
d4cdad5
@@ -410,6 +410,7 @@ static void usbredir_stop_iso_stream(USBRedirDevice *dev, uint8_t ep)
d4cdad5
         DPRINTF("iso stream stopped ep %02X\n", ep);
d4cdad5
         dev->endpoint[EP2I(ep)].iso_started = 0;
d4cdad5
     }
d4cdad5
+    dev->endpoint[EP2I(ep)].iso_error = 0;
d4cdad5
     usbredir_free_bufpq(dev, ep);
d4cdad5
 }
d4cdad5
d4cdad5
@@ -522,6 +523,7 @@ static void usbredir_stop_interrupt_receiving(USBRedirDevice *dev,
d4cdad5
         DPRINTF("interrupt recv stopped ep %02X\n", ep);
d4cdad5
         dev->endpoint[EP2I(ep)].interrupt_started = 0;
d4cdad5
     }
d4cdad5
+    dev->endpoint[EP2I(ep)].interrupt_error = 0;
d4cdad5
     usbredir_free_bufpq(dev, ep);
d4cdad5
 }
d4cdad5
d4cdad5
@@ -1029,7 +1031,7 @@ static void usbredir_iso_stream_status(void *priv, uint32_t id,
d4cdad5
     DPRINTF("iso status %d ep %02X id %u\n", iso_stream_status->status,
d4cdad5
             ep, id);
d4cdad5
d4cdad5
-    if (!dev->dev.attached) {
d4cdad5
+    if (!dev->dev.attached || !dev->endpoint[EP2I(ep)].iso_started) {
d4cdad5
         return;
d4cdad5
     }
d4cdad5
d4cdad5
@@ -1050,7 +1052,7 @@ static void usbredir_interrupt_receiving_status(void *priv, uint32_t id,
d4cdad5
     DPRINTF("interrupt recv status %d ep %02X id %u\n",
d4cdad5
             interrupt_receiving_status->status, ep, id);
d4cdad5
d4cdad5
-    if (!dev->dev.attached) {
d4cdad5
+    if (!dev->dev.attached || !dev->endpoint[EP2I(ep)].interrupt_started) {
d4cdad5
         return;
d4cdad5
     }
d4cdad5
d4cdad5
-- 
d4cdad5
1.7.7.5
d4cdad5