summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorClaudio Takahasi <claudio.takahasi@openbossa.org>2007-05-09 19:33:49 +0000
committerClaudio Takahasi <claudio.takahasi@openbossa.org>2007-05-09 19:33:49 +0000
commit9e824dd2ce0e935616074a7242eab1a57fa8b86f (patch)
tree46ab850989dade2e4be51e249cf42b063b831cdb
parent1dd87340fa57eb1a6b32f3cb78cc3a309e076b09 (diff)
serial: handle the pending connects list properly when connect() in the first try happens
-rw-r--r--serial/manager.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/serial/manager.c b/serial/manager.c
index 4de3ce87..f4480404 100644
--- a/serial/manager.c
+++ b/serial/manager.c
@@ -513,7 +513,6 @@ static int rfcomm_connect(struct pending_connect *pc)
debug("Connect in progress");
g_io_add_watch(io, G_IO_OUT, (GIOFunc) rfcomm_connect_cb, pc);
- pending_connects = g_slist_append(pending_connects, pc);
} else {
debug("Connect succeeded with first try");
(void) rfcomm_connect_cb(io, G_IO_OUT, pc);
@@ -829,11 +828,15 @@ static DBusHandlerResult connect_service(DBusConnection *conn,
"invalid RFCOMM channel");
}
+ /* Add here since connect() in the first try can happen */
+ pending_connects = g_slist_append(pending_connects, pc);
+
pc->channel = val;
err = rfcomm_connect(pc);
if (err < 0) {
const char *strerr = strerror(-err);
error("RFCOMM connect failed: %s(%d)", strerr, -err);
+ pending_connects = g_slist_remove(pending_connects, pc);
pending_connect_free(pc);
return err_connection_failed(conn, msg, strerr);
}