[Spice-commits] 2 commits - server/reds.c

Frediano Ziglio fziglio at kemper.freedesktop.org
Wed Feb 10 17:30:30 UTC 2016


 server/reds.c |    7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

New commits:
commit 35d1fbff1dd5ffb1e12b340fb2ee49a8ab56981d
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Feb 10 17:57:40 2016 +0100

    reds: Pass RedState instance to reds_accept()
    
    Rather than relying on a global 'reds' variable, we can pass the needed
    instance through the callback user data.
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/reds.c b/server/reds.c
index 4fba4f1..d7acab5 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2374,6 +2374,7 @@ static void reds_accept_ssl_connection(int fd, int event, void *data)
 
 static void reds_accept(int fd, int event, void *data)
 {
+    RedsState *reds = data;
     int socket;
 
     if ((socket = accept(reds->listen_socket, NULL, 0)) == -1) {
@@ -2537,7 +2538,7 @@ static int reds_init_net(RedsState *reds)
         }
         reds->listen_watch = core->watch_add(core, reds->listen_socket,
                                              SPICE_WATCH_EVENT_READ,
-                                             reds_accept, NULL);
+                                             reds_accept, reds);
         if (reds->listen_watch == NULL) {
             spice_warning("set fd handle failed");
             return -1;
@@ -2563,7 +2564,7 @@ static int reds_init_net(RedsState *reds)
         reds->listen_socket = reds->spice_listen_socket_fd;
         reds->listen_watch = core->watch_add(core, reds->listen_socket,
                                              SPICE_WATCH_EVENT_READ,
-                                             reds_accept, NULL);
+                                             reds_accept, reds);
         if (reds->listen_watch == NULL) {
             spice_warning("set fd handle failed");
             return -1;
commit 3fa733a800d1980d5b1b6be1955d384eadef46c7
Author: Christophe Fergeau <cfergeau at redhat.com>
Date:   Wed Feb 10 17:57:39 2016 +0100

    reds: Make sure accept_ssl_connection() gets a reds instance
    
    Commit 3a66b75 changed reds_accept_ssl_connection() to expect a RedState
    instance when its called, but the core->watch_add() which is calling it
    was not changed accordingly. This causes a crash when connecting through
    SSL.
    
    Acked-by: Frediano Ziglio <fziglio at redhat.com>

diff --git a/server/reds.c b/server/reds.c
index a46c194..4fba4f1 100644
--- a/server/reds.c
+++ b/server/reds.c
@@ -2552,7 +2552,7 @@ static int reds_init_net(RedsState *reds)
         }
         reds->secure_listen_watch = core->watch_add(core, reds->secure_listen_socket,
                                                     SPICE_WATCH_EVENT_READ,
-                                                    reds_accept_ssl_connection, NULL);
+                                                    reds_accept_ssl_connection, reds);
         if (reds->secure_listen_watch == NULL) {
             spice_warning("set fd handle failed");
             return -1;


More information about the Spice-commits mailing list