mirror of
https://gitlab.uni-freiburg.de/opensourcevdi/spice
synced 2026-01-06 08:27:00 +00:00
net-utils: Port to Windows
Signed-off-by: Frediano Ziglio <fziglio@redhat.com> Acked-by: Victor Toso <victortoso@redhat.com>
This commit is contained in:
parent
0c59394b24
commit
026fab1825
@ -33,6 +33,7 @@
|
||||
#include <common/log.h>
|
||||
|
||||
#include "net-utils.h"
|
||||
#include "sys-socket.h"
|
||||
|
||||
/**
|
||||
* red_socket_set_keepalive:
|
||||
@ -99,6 +100,15 @@ bool red_socket_set_no_delay(int fd, bool no_delay)
|
||||
*/
|
||||
bool red_socket_set_non_blocking(int fd, bool non_blocking)
|
||||
{
|
||||
#ifdef _WIN32
|
||||
u_long ioctl_nonblocking = 1;
|
||||
|
||||
if (ioctlsocket(fd, FIONBIO, &ioctl_nonblocking) != 0) {
|
||||
spice_warning("ioctlsocket(FIONBIO) failed, %d", WSAGetLastError());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
#else
|
||||
int flags;
|
||||
|
||||
if ((flags = fcntl(fd, F_GETFL)) == -1) {
|
||||
@ -118,6 +128,7 @@ bool red_socket_set_non_blocking(int fd, bool non_blocking)
|
||||
}
|
||||
|
||||
return true;
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user