aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/listen.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/listen.c b/src/listen.c
index 62d4e2e60..d0dfa3c71 100644
--- a/src/listen.c
+++ b/src/listen.c
@@ -58,6 +58,8 @@ struct listen_socket {
struct listen_socket *next;
int fd;
+
+ guint source_id;
};
static struct listen_socket *listen_sockets;
@@ -101,8 +103,8 @@ static int establishListen(int pf, const struct sockaddr *addrp,
ls->fd = sock;
channel = g_io_channel_unix_new(sock);
- g_io_add_watch(channel, G_IO_IN,
- listen_in_event, GINT_TO_POINTER(sock));
+ ls->source_id = g_io_add_watch(channel, G_IO_IN,
+ listen_in_event, GINT_TO_POINTER(sock));
g_io_channel_unref(channel);
ls->next = listen_sockets;
@@ -281,6 +283,7 @@ void closeAllListenSockets(void)
struct listen_socket *ls = listen_sockets;
listen_sockets = ls->next;
+ g_source_remove(ls->source_id);
close(ls->fd);
g_free(ls);
}