summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Hurley <phurley@charter.net>2009-09-09 13:25:35 -0400
committerJohan Hedberg <johan.hedberg@nokia.com>2009-09-09 20:53:47 +0300
commit854ac30779045bc692f2fd7687a233c378d3d803 (patch)
tree5d1dac797398aa7fa5583701c69ff2250cda6483
parent28b19ec20bcc431c14aa205f7a2ce6d7424449a5 (diff)
Fixed duplicate attempt from device to connect 'signalling' channel
A device may attempt to initiate a duplicate avdtp channel while a host-initiated channel connection is still pending. This situation is referred to as 'XCASE connect:connect' in sink.c and source.c. This fix rejects the device-initiated connection in this circumstance.
-rw-r--r--audio/avdtp.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/audio/avdtp.c b/audio/avdtp.c
index 131ff4faf..2a27ac807 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -2119,6 +2119,18 @@ static void avdtp_confirm_cb(GIOChannel *chan, gpointer data)
if (!session)
goto drop;
+ /* This state (ie, session is already *connecting*) happens when the
+ * device initiates a connect (really a config'd L2CAP channel) even
+ * though there is a connect we initiated in progress. In sink.c &
+ * source.c, this state is referred to as XCASE connect:connect.
+ * Abort the device's channel in favor of our own.
+ */
+ if (session->state == AVDTP_SESSION_STATE_CONNECTING) {
+ debug("avdtp_confirm_cb: connect already in progress"
+ " (XCASE connect:connect)");
+ goto drop;
+ }
+
if (session->pending_open && session->pending_open->open_acp) {
if (!bt_io_accept(chan, avdtp_connect_cb, session, NULL, NULL))
goto drop;