[PATCH BlueZ] shared/att: Don't keep retrying the same operation

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

 



From: Luiz Augusto von Dentz <luiz.von.dentz@xxxxxxxxx>

If an operation has been retried already don't attempt to change the
security again.
---
 src/shared/att.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/src/shared/att.c b/src/shared/att.c
index 85feead77d0f..62c884b65721 100644
--- a/src/shared/att.c
+++ b/src/shared/att.c
@@ -193,6 +193,7 @@ struct att_send_op {
 	uint8_t opcode;
 	void *pdu;
 	uint16_t len;
+	bool retry;
 	bt_att_response_func_t callback;
 	bt_att_destroy_func_t destroy;
 	void *user_data;
@@ -785,6 +786,12 @@ static bool handle_error_rsp(struct bt_att_chan *chan, uint8_t *pdu,
 
 	*opcode = rsp->opcode;
 
+	/* If operation has already been marked as retry don't attempt to change
+	 * the security again.
+	 */
+	if (op->retry)
+		return false;
+
 	/* Attempt to change security */
 	if (!change_security(chan, rsp->ecode))
 		return false;
@@ -798,6 +805,7 @@ static bool handle_error_rsp(struct bt_att_chan *chan, uint8_t *pdu,
 	DBG(att, "(chan %p) Retrying operation %p", chan, op);
 
 	chan->pending_req = NULL;
+	op->retry = true;
 
 	/* Push operation back to channel queue */
 	return queue_push_head(chan->queue, op);
-- 
2.41.0




[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