summaryrefslogtreecommitdiffstats
path: root/audio/avdtp.c
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2007-08-12 17:03:11 +0000
committerJohan Hedberg <johan.hedberg@nokia.com>2007-08-12 17:03:11 +0000
commitfb58bd1b24d257ea884aa5d67f8e5a6362aafa94 (patch)
tree63ba41bfede521e93a71bb85dba74a34b7b5b790 /audio/avdtp.c
parentffdc158c69f7aa3a0e8ce4a67c1a42da33b19c2b (diff)
Fix set_configuration reject response error codes
Diffstat (limited to 'audio/avdtp.c')
-rw-r--r--audio/avdtp.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/audio/avdtp.c b/audio/avdtp.c
index ec20958c..07ca7d42 100644
--- a/audio/avdtp.c
+++ b/audio/avdtp.c
@@ -684,6 +684,7 @@ static gboolean avdtp_setconf_cmd(struct avdtp *session,
struct setconf_resp *rsp = (struct setconf_resp *) session->buf;
struct avdtp_local_sep *lsep;
gboolean ret;
+ uint8_t err;
if (size < sizeof(struct setconf_req)) {
error("Too short getcap request");
@@ -691,11 +692,14 @@ static gboolean avdtp_setconf_cmd(struct avdtp *session,
}
lsep = find_local_sep_by_seid(req->acp_seid);
- if (!lsep || lsep->stream) {
- init_response(&rej.header, &req->header, FALSE);
- rej.error = AVDTP_BAD_ACP_SEID;
- rej.category = 0x00; /* 0x00 means "not applicable" */
- return avdtp_send(session, &rej, sizeof(rej));
+ if (!lsep) {
+ err = AVDTP_BAD_ACP_SEID;
+ goto failed;
+ }
+
+ if (lsep->stream) {
+ err = AVDTP_SEP_IN_USE;
+ goto failed;
}
init_response(&rsp->header, &req->header, TRUE);
@@ -706,6 +710,12 @@ static gboolean avdtp_setconf_cmd(struct avdtp *session,
avdtp_sep_set_state(session, lsep, AVDTP_STATE_CONFIGURED);
return ret;
+
+failed:
+ init_response(&rej.header, &req->header, FALSE);
+ rej.error = err;
+ rej.category = 0x00; /* 0x00 means "not applicable" */
+ return avdtp_send(session, &rej, sizeof(rej));
}
static gboolean avdtp_getconf_cmd(struct avdtp *session, struct seid_req *req,