[PATCH spice-server 2/2] test-websocket: Reuse red_socket_set_non_blocking

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

 



Signed-off-by: Frediano Ziglio <fziglio@xxxxxxxxxx>
---
 server/tests/test-websocket.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/server/tests/test-websocket.c b/server/tests/test-websocket.c
index e74cb5497..432aeee5c 100644
--- a/server/tests/test-websocket.c
+++ b/server/tests/test-websocket.c
@@ -39,6 +39,7 @@
 #include <glib.h>
 #include <signal.h>
 
+#include "net-utils.h"
 #include "websocket.h"
 
 /*
@@ -73,16 +74,6 @@ static GOptionEntry cmd_entries[] = {
 
 static void handle_client(int new_sock);
 
-static void
-set_nonblocking(int sock)
-{
-        unsigned int ioctl_nonblocking = 1;
-
-        if (ioctl(sock, FIONBIO, &ioctl_nonblocking) < 0) {
-            err(1, "ioctl");
-        }
-}
-
 static int
 wait_for(int sock, short events)
 {
@@ -158,7 +149,7 @@ main(int argc, char **argv)
     setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, &enable, sizeof(enable));
 
     if (non_blocking) {
-        set_nonblocking(sock);
+        red_socket_set_non_blocking(sock, true);
     }
 
     struct sockaddr_in sin;
@@ -205,7 +196,7 @@ static void
 handle_client(int new_sock)
 {
     if (non_blocking) {
-        set_nonblocking(new_sock);
+        red_socket_set_non_blocking(new_sock, true);
     }
 
     int enable = 1;
-- 
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]