From 9e824dd2ce0e935616074a7242eab1a57fa8b86f Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Wed, 9 May 2007 19:33:49 +0000 Subject: serial: handle the pending connects list properly when connect() in the first try happens --- serial/manager.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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); } -- cgit