summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2007-04-05 13:34:30 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2007-04-05 13:34:30 +0000
commit3b97946c32b28af92a5a809bb690dc9be3af6eaf (patch)
tree69b9d3be70f4b4ea83776bffacbb1619b0882b7d
parent0eede007ad95a1d972b43e860164d32effcde9c9 (diff)
input: fixed GIOChannel problem(CPU usage and invalid file descriptor close warning)
-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);