summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristophe Fergeau <cfergeau@redhat.com>2016-02-10 17:57:40 +0100
committerFrediano Ziglio <fziglio@redhat.com>2016-02-10 17:30:03 +0000
commit35d1fbff1dd5ffb1e12b340fb2ee49a8ab56981d (patch)
tree8b59b0727ffbeb2af8972e89fe7afc0c8a9481c0
parent3fa733a800d1980d5b1b6be1955d384eadef46c7 (diff)
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@redhat.com>
-rw-r--r--server/reds.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/server/reds.c b/server/reds.c
index 4fba4f1d..d7acab5c 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;