summaryrefslogtreecommitdiffstats
path: root/input/server.c
diff options
context:
space:
mode:
Diffstat (limited to 'input/server.c')
-rw-r--r--input/server.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/input/server.c b/input/server.c
index b3bde829..82895816 100644
--- a/input/server.c
+++ b/input/server.c
@@ -71,9 +71,14 @@ static struct session_data *find_session(bdaddr_t *src, bdaddr_t *dst)
static gboolean session_event(GIOChannel *chan, GIOCondition cond, gpointer data)
{
- if (cond & (G_IO_HUP | G_IO_ERR | G_IO_NVAL))
+ if (cond & G_IO_NVAL)
return FALSE;
+ if (cond & (G_IO_HUP | G_IO_ERR)) {
+ g_io_channel_close(chan);
+ return FALSE;
+ }
+
return TRUE;
}
@@ -219,7 +224,6 @@ static void create_watch(int sk, struct session_data *session)
GIOChannel *io;
io = g_io_channel_unix_new(sk);
- g_io_channel_set_close_on_unref(io, TRUE);
g_io_add_watch(io, G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
session_event, session);