network: Fix warning when removing connection timeout handler

The source should only be removed once as it can cause the following
warning:

GLib-CRITICAL **: g_source_remove: assertion `tag > 0' failed
This commit is contained in:
Luiz Augusto von Dentz 2012-08-23 18:40:00 +03:00
parent 889b97e685
commit b809cae236

View File

@ -207,8 +207,10 @@ static gboolean bnep_setup_cb(GIOChannel *chan, GIOCondition cond,
if (cond & G_IO_NVAL)
return FALSE;
g_source_remove(nc->timeout_source);
nc->timeout_source = 0;
if (nc->timeout_source > 0) {
g_source_remove(nc->timeout_source);
nc->timeout_source = 0;
}
if (cond & (G_IO_HUP | G_IO_ERR)) {
error("Hangup or error on l2cap server socket");