From 469b94eb4e54139fd11ea3705d8be82b58fb4c3f Mon Sep 17 00:00:00 2001 From: Frediano Ziglio Date: Sun, 12 Feb 2017 21:03:23 +0000 Subject: [PATCH] Do not set not blocking flag twice Non blocking flag is set for all connection inside reds.c so there's no need to set again for the single client channel. Signed-off-by: Frediano Ziglio Acked-by: Christophe Fergeau --- server/common-graphics-channel.c | 11 ----------- server/sound.c | 11 ----------- 2 files changed, 22 deletions(-) diff --git a/server/common-graphics-channel.c b/server/common-graphics-channel.c index 29aa5835..bad6e8cd 100644 --- a/server/common-graphics-channel.c +++ b/server/common-graphics-channel.c @@ -117,20 +117,9 @@ int common_channel_config_socket(RedChannelClient *rcc) RedClient *client = red_channel_client_get_client(rcc); MainChannelClient *mcc = red_client_get_main(client); RedsStream *stream = red_channel_client_get_stream(rcc); - int flags; int delay_val; gboolean is_low_bandwidth; - if ((flags = fcntl(stream->socket, F_GETFL)) == -1) { - spice_warning("accept failed, %s", strerror(errno)); - return FALSE; - } - - if (fcntl(stream->socket, F_SETFL, flags | O_NONBLOCK) == -1) { - spice_warning("accept failed, %s", strerror(errno)); - return FALSE; - } - // TODO - this should be dynamic, not one time at channel creation is_low_bandwidth = main_channel_client_is_low_bandwidth(mcc); delay_val = is_low_bandwidth ? 0 : 1; diff --git a/server/sound.c b/server/sound.c index 68aa1918..e83a5476 100644 --- a/server/sound.c +++ b/server/sound.c @@ -740,7 +740,6 @@ static void record_channel_send_item(RedChannelClient *rcc, G_GNUC_UNUSED RedPip static int snd_channel_config_socket(RedChannelClient *rcc) { int delay_val; - int flags; #ifdef SO_PRIORITY int priority; #endif @@ -749,11 +748,6 @@ static int snd_channel_config_socket(RedChannelClient *rcc) RedClient *red_client = red_channel_client_get_client(rcc); MainChannelClient *mcc = red_client_get_main(red_client); - if ((flags = fcntl(stream->socket, F_GETFL)) == -1) { - spice_printerr("accept failed, %s", strerror(errno)); - return FALSE; - } - #ifdef SO_PRIORITY priority = 6; if (setsockopt(stream->socket, SOL_SOCKET, SO_PRIORITY, (void*)&priority, @@ -778,11 +772,6 @@ static int snd_channel_config_socket(RedChannelClient *rcc) } } - if (fcntl(stream->socket, F_SETFL, flags | O_NONBLOCK) == -1) { - spice_printerr("accept failed, %s", strerror(errno)); - return FALSE; - } - return TRUE; }