diff options
author | Jaikumar Ganesh <jaikumar@google.com> | 2011-02-17 11:42:00 -0800 |
---|---|---|
committer | Jaikumar Ganesh <jaikumar@google.com> | 2011-05-25 11:51:56 -0700 |
commit | 7c3e0a88b012c770b4d9086a570073d9df317899 (patch) | |
tree | ae325d2b3bf031698e3804cf805e3959b4949803 | |
parent | 687412348091e7fe79dcc8448df713329f35b0a4 (diff) | |
download | bluez-7c3e0a88b012c770b4d9086a570073d9df317899.tar.gz |
Fix removing the watch when network session is freed.
This fixes bluetoothd taking a lot of CPU when local
NAP role connection is disconnected.
Change-Id: I8be15622d4dc3bb1a33867e6472b899928473d40
-rw-r--r-- | network/server.c | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/network/server.c b/network/server.c index 975c7e72..674d1ae3 100644 --- a/network/server.c +++ b/network/server.c @@ -59,6 +59,7 @@ struct network_session { bdaddr_t dst; /* Remote Bluetooth Address */ GIOChannel *io; /* Pending connect channel */ guint watch; /* BNEP socket watch */ + guint io_watch; }; struct network_adapter { @@ -298,6 +299,9 @@ static void session_free(void *data) if (session->watch) g_source_remove(session->watch); + if (session->io_watch) + g_source_remove(session->io_watch); + if (session->io) g_io_channel_unref(session->io); @@ -368,7 +372,7 @@ static int server_connadd(struct network_server *ns, DBUS_TYPE_UINT16, &dst_role, DBUS_TYPE_INVALID); - g_io_add_watch(session->io, G_IO_ERR | G_IO_HUP, + session->io_watch = g_io_add_watch(session->io, G_IO_ERR | G_IO_HUP, (GIOFunc) bnep_watchdog_cb, ns); return 0; |