[PATCH spice-server v5 07/18] net-utils: Port to Windows

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/net-utils.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/server/net-utils.c b/server/net-utils.c
index 802509a49..3034dc5e1 100644
--- a/server/net-utils.c
+++ b/server/net-utils.c
@@ -35,6 +35,7 @@
 #include <common/log.h>
 
 #include "net-utils.h"
+#include "sys-socket.h"
 
 /**
  * red_socket_set_keepalive:
@@ -101,6 +102,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) {
@@ -120,6 +130,7 @@ bool red_socket_set_non_blocking(int fd, bool non_blocking)
     }
 
     return true;
+#endif
 }
 
 /**
-- 
2.20.1

_______________________________________________
Spice-devel mailing list
Spice-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/spice-devel




[Index of Archives]     [Linux Virtualization]     [Linux Virtualization]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]     [Monitors]