[Spice-devel] [PATCH spice-server 3/4] Do not set TCP_NODELAY flag twice

Frediano Ziglio fziglio at redhat.com
Mon Feb 13 11:03:18 UTC 2017


TCP_NODELAY flag is set by default for all connection inside
reds.c so there's no need to set again for the single
client channel.

Note that there are still some call to setsockopt to set this
option but in this case the flag can reset the flag.

Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
---
 server/inputs-channel.c | 11 -----------
 server/spicevmc.c       | 16 ----------------
 2 files changed, 27 deletions(-)

diff --git a/server/inputs-channel.c b/server/inputs-channel.c
index f105b4d..897e8e7 100644
--- a/server/inputs-channel.c
+++ b/server/inputs-channel.c
@@ -490,17 +490,6 @@ static void inputs_pipe_add_init(RedChannelClient *rcc)
 
 static int inputs_channel_config_socket(RedChannelClient *rcc)
 {
-    int delay_val = 1;
-    RedsStream *stream = red_channel_client_get_stream(rcc);
-
-    if (setsockopt(stream->socket, IPPROTO_TCP, TCP_NODELAY,
-            &delay_val, sizeof(delay_val)) == -1) {
-        if (errno != ENOTSUP && errno != ENOPROTOOPT) {
-            spice_printerr("setsockopt failed, %s", strerror(errno));
-            return FALSE;
-        }
-    }
-
     return TRUE;
 }
 
diff --git a/server/spicevmc.c b/server/spicevmc.c
index 9bcbada..1003a2f 100644
--- a/server/spicevmc.c
+++ b/server/spicevmc.c
@@ -427,22 +427,6 @@ static void spicevmc_char_dev_remove_client(RedCharDevice *self,
 
 static int spicevmc_red_channel_client_config_socket(RedChannelClient *rcc)
 {
-    int delay_val = 1;
-    RedsStream *stream = red_channel_client_get_stream(rcc);
-    RedChannel *channel = red_channel_client_get_channel(rcc);
-    uint32_t type;
-
-    g_object_get(channel, "channel-type", &type, NULL);
-    if (type == SPICE_CHANNEL_USBREDIR) {
-        if (setsockopt(stream->socket, IPPROTO_TCP, TCP_NODELAY,
-                &delay_val, sizeof(delay_val)) != 0) {
-            if (errno != ENOTSUP && errno != ENOPROTOOPT) {
-                spice_printerr("setsockopt failed, %s", strerror(errno));
-                return FALSE;
-            }
-        }
-    }
-
     return TRUE;
 }
 
-- 
2.9.3



More information about the Spice-devel mailing list