server: Don't complain if setsockopt NODELAY fails on unix sockets

With Daniel P. Berrange's patches to allow use of pre-supplied fd's
as channels, we can no longer be sure that our connections are TCP
sockets, so it makes no sense to complain if a TCP/IP specific
setsockopt fails with an errno of ENOTSUP.

Note that this extends Daniel's commit 492ddb5d1d
which already added the same check to server/inputs_channel.c

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
Hans de Goede 2012-01-18 10:47:30 +01:00
parent b5060ff813
commit dc7855967f
5 changed files with 19 additions and 7 deletions

View File

@ -3365,7 +3365,9 @@ static int tunnel_channel_config_socket(RedChannelClient *rcc)
if (setsockopt(stream->socket, IPPROTO_TCP, TCP_NODELAY, &delay_val,
sizeof(delay_val)) == -1) {
red_printf("setsockopt failed, %s", strerror(errno));
if (errno != ENOTSUP) {
red_printf("setsockopt failed, %s", strerror(errno));
}
}
return TRUE;

View File

@ -9498,7 +9498,9 @@ static int common_channel_config_socket(RedChannelClient *rcc)
// TODO - this should be dynamic, not one time at channel creation
delay_val = main_channel_client_is_low_bandwidth(mcc) ? 0 : 1;
if (setsockopt(stream->socket, IPPROTO_TCP, TCP_NODELAY, &delay_val, sizeof(delay_val)) == -1) {
red_printf("setsockopt failed, %s", strerror(errno));
if (errno != ENOTSUP) {
red_printf("setsockopt failed, %s", strerror(errno));
}
}
return TRUE;
}

View File

@ -2706,7 +2706,9 @@ static RedLinkInfo *reds_init_client_connection(int socket)
}
if (setsockopt(socket, IPPROTO_TCP, TCP_NODELAY, &delay_val, sizeof(delay_val)) == -1) {
red_printf("setsockopt failed, %s", strerror(errno));
if (errno != ENOTSUP) {
red_printf("setsockopt failed, %s", strerror(errno));
}
}
link = spice_new0(RedLinkInfo, 1);

View File

@ -919,12 +919,16 @@ static SndChannel *__new_channel(SndWorker *worker, int size, uint32_t channel_i
tos = IPTOS_LOWDELAY;
if (setsockopt(stream->socket, IPPROTO_IP, IP_TOS, (void*)&tos, sizeof(tos)) == -1) {
red_printf("setsockopt failed, %s", strerror(errno));
if (errno != ENOTSUP) {
red_printf("setsockopt failed, %s", strerror(errno));
}
}
delay_val = main_channel_client_is_low_bandwidth(mcc) ? 0 : 1;
if (setsockopt(stream->socket, IPPROTO_TCP, TCP_NODELAY, &delay_val, sizeof(delay_val)) == -1) {
red_printf("setsockopt failed, %s", strerror(errno));
if (errno != ENOTSUP) {
red_printf("setsockopt failed, %s", strerror(errno));
}
}
if (fcntl(stream->socket, F_SETFL, flags | O_NONBLOCK) == -1) {

View File

@ -92,8 +92,10 @@ static int spicevmc_red_channel_client_config_socket(RedChannelClient *rcc)
if (rcc->channel->type == SPICE_CHANNEL_USBREDIR) {
if (setsockopt(stream->socket, IPPROTO_TCP, TCP_NODELAY,
&delay_val, sizeof(delay_val)) != 0) {
red_printf("setsockopt failed, %s", strerror(errno));
return FALSE;
if (errno != ENOTSUP) {
red_printf("setsockopt failed, %s", strerror(errno));
return FALSE;
}
}
}