[Spice-commits] 2 commits - server/tests

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 6 12:46:16 UTC 2019


 server/tests/test-websocket.c |   19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

New commits:
commit 32ee52df1658a0ebb597f8904b36af85ea94253a
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Tue Jul 16 18:19:08 2019 +0100

    test-websocket: Reuse red_socket_set_non_blocking
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Uri Lublin <uril at redhat.com>

diff --git a/server/tests/test-websocket.c b/server/tests/test-websocket.c
index e74cb549..432aeee5 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;
commit 5f62d03073514dc857f452f16c88bf9aa2c546b9
Author: Frediano Ziglio <fziglio at redhat.com>
Date:   Tue Jul 16 18:18:40 2019 +0100

    test-websocket: Some Windows compatibility
    
    Don't call close but socket_close.
    
    Signed-off-by: Frediano Ziglio <fziglio at redhat.com>
    Acked-by: Uri Lublin <uril at redhat.com>

diff --git a/server/tests/test-websocket.c b/server/tests/test-websocket.c
index dc7b7d34..e74cb549 100644
--- a/server/tests/test-websocket.c
+++ b/server/tests/test-websocket.c
@@ -193,10 +193,10 @@ main(int argc, char **argv)
         ++num_connections;
         handle_client(new_sock);
 
-        close(new_sock);
+        socket_close(new_sock);
     }
 
-    close(sock);
+    socket_close(sock);
     printf("handled %u connections\n", num_connections);
     return 0;
 }


More information about the Spice-commits mailing list