[Spice-devel] [PATCH] server/red_channel: fix unused variable

Alon Levy alevy at redhat.com
Sun Jul 28 12:14:24 PDT 2013


unused variable 'so_unsent_size' [-Werror=unused-variable]
---
Nahum, could you check that this works for you?

 server/red_channel.c | 23 +++++++++++++----------
 1 file changed, 13 insertions(+), 10 deletions(-)

diff --git a/server/red_channel.c b/server/red_channel.c
index 31c991b..33af388 100644
--- a/server/red_channel.c
+++ b/server/red_channel.c
@@ -720,22 +720,25 @@ static void red_channel_client_push_ping(RedChannelClient *rcc)
 
 static void red_channel_client_ping_timer(void *opaque)
 {
-    int so_unsent_size = 0;
     RedChannelClient *rcc = opaque;
 
     spice_assert(rcc->latency_monitor.state == PING_STATE_TIMER);
     red_channel_client_cancel_ping_timer(rcc);
 
 #ifdef HAVE_LINUX_SOCKIOS_H /* SIOCOUTQ is a Linux only ioctl on sockets. */
-    /* retrieving the occupied size of the socket's tcp snd buffer (unacked + unsent) */
-    if (ioctl(rcc->stream->socket, SIOCOUTQ, &so_unsent_size) == -1) {
-        spice_printerr("ioctl(SIOCOUTQ) failed, %s", strerror(errno));
-    }
-    if (so_unsent_size > 0) {
-        /* tcp snd buffer is still occupied. rescheduling ping */
-        red_channel_client_start_ping_timer(rcc, PING_TEST_IDLE_NET_TIMEOUT_MS);
-    } else {
-        red_channel_client_push_ping(rcc);
+    {
+        int so_unsent_size = 0;
+
+        /* retrieving the occupied size of the socket's tcp snd buffer (unacked + unsent) */
+        if (ioctl(rcc->stream->socket, SIOCOUTQ, &so_unsent_size) == -1) {
+            spice_printerr("ioctl(SIOCOUTQ) failed, %s", strerror(errno));
+        }
+        if (so_unsent_size > 0) {
+            /* tcp snd buffer is still occupied. rescheduling ping */
+            red_channel_client_start_ping_timer(rcc, PING_TEST_IDLE_NET_TIMEOUT_MS);
+        } else {
+            red_channel_client_push_ping(rcc);
+        }
     }
 #else /* ifdef HAVE_LINUX_SOCKIOS_H */
     /* More portable alternative code path (less accurate but avoids bogus ioctls)*/
-- 
1.8.3.1



More information about the Spice-devel mailing list