[PATCH 38/60] Don't delete aborted MDLS

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: José Antonio Santos-Cadenas <santoscadenas@xxxxxxxxx>

When a request for abort MDL creation fails we shouldn't delete the
MDL because it may be used for future reconnections.
---
 mcap/mcap.c |   14 ++++++--------
 1 files changed, 6 insertions(+), 8 deletions(-)

diff --git a/mcap/mcap.c b/mcap/mcap.c
index 87aa233..d268bf6 100644
--- a/mcap/mcap.c
+++ b/mcap/mcap.c
@@ -1042,7 +1042,7 @@ static void process_md_abort_mdl_req(struct mcap_mcl *mcl, uint8_t *cmd,
 {
 	mcap_md_req *req;
 	GSList *l;
-	struct mcap_mdl *mdl, *del;
+	struct mcap_mdl *mdl, *abrt;
 	uint16_t mdl_id;
 
 	if (len != sizeof(mcap_md_req)) {
@@ -1057,7 +1057,7 @@ static void process_md_abort_mdl_req(struct mcap_mcl *mcl, uint8_t *cmd,
 	for (l = mcl->mdls; l; l = l->next) {
 		mdl = l->data;
 		if ((mdl_id == mdl->mdlid) && (mdl->state == MDL_WAITING)) {
-			del = mdl;
+			abrt = mdl;
 			if (mcl->state != MCL_CONNECTED)
 				break;
 			continue;
@@ -1065,20 +1065,18 @@ static void process_md_abort_mdl_req(struct mcap_mcl *mcl, uint8_t *cmd,
 		if ((mdl->state == MDL_CONNECTED) && (mcl->state != MCL_ACTIVE))
 			mcl->state = MCL_ACTIVE;
 
-		if ((del) && (mcl->state == MCL_ACTIVE))
+		if ((abrt) && (mcl->state == MCL_ACTIVE))
 			break;
 	}
 
-	if (!del) {
+	if (!abrt) {
 		send4B_cmd(mcl, MCAP_MD_ABORT_MDL_RSP, MCAP_INVALID_MDL,
 									mdl_id);
 		return;
 	}
 
-	mcl->cb->mdl_aborted(del, mcl->cb->user_data);
-
-	mcl->mdls = g_slist_remove(mcl->mdls, del);
-	g_free(del);
+	mcl->cb->mdl_aborted(abrt, mcl->cb->user_data);
+	abrt->state = MDL_CLOSED;
 	send4B_cmd(mcl, MCAP_MD_ABORT_MDL_RSP, MCAP_SUCCESS, mdl_id);
 }
 
-- 
1.6.3.3

--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux