mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-08 21:14:11 +00:00
Fix compatibility with TCP_KEEPIDLE and Darwin
Darwin uses for the same setting the TCP_KEEPALIVE option. Use TCP_KEEPALIVE instead of TCP_KEEPIDLE for Darwin. Signed-off-by: Frediano Ziglio <fziglio@redhat.com>
This commit is contained in:
parent
8772163cf9
commit
90453ddf06
@ -35,6 +35,10 @@
|
||||
#include "net-utils.h"
|
||||
#include "sys-socket.h"
|
||||
|
||||
#if !defined(TCP_KEEPIDLE) && defined(TCP_KEEPALIVE) && defined(__APPLE__)
|
||||
#define TCP_KEEPIDLE TCP_KEEPALIVE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* red_socket_set_keepalive:
|
||||
* @fd: a socket file descriptor
|
||||
@ -57,7 +61,7 @@ bool red_socket_set_keepalive(int fd, bool enable, int timeout)
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifdef HAVE_TCP_KEEPIDLE
|
||||
#ifdef TCP_KEEPIDLE
|
||||
if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &timeout, sizeof(timeout)) == -1) {
|
||||
if (errno != ENOTSUP) {
|
||||
g_warning("setsockopt for keepalive timeout failed, %s", strerror(errno));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user