Re: [PATCH] server/red_channel: fix unused variable

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 07/28/2013 03:14 PM, Alon Levy wrote:
unused variable 'so_unsent_size' [-Werror=unused-variable]
---
Nahum, could you check that this works for you?
Works for me*. Sorry for introducing a compiler error!
-Nahum

* As much as the other patch works. It compiles and runs, but I get a freeze the first time video detection is triggered...


  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)*/

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]