mirror of
https://git.kernel.org/pub/scm/bluetooth/bluez.git
synced 2024-11-17 17:24:32 +08:00
serial: handle the pending connects list properly when connect() in the first try happens
This commit is contained in:
parent
1dd87340fa
commit
9e824dd2ce
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user