summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohan Hedberg <johan.hedberg@nokia.com>2009-03-18 20:50:51 +0200
committerJohan Hedberg <johan.hedberg@nokia.com>2009-03-18 20:50:51 +0200
commit0cd8e651b6f004bcc64387d59f6bcb29190ffed6 (patch)
tree025831804661bb8f7a9966e7b59883dafd1dfa15
parentd1ea609881befd71e3251e33c02c2d5e5bb5380b (diff)
Attempt SDP a second time if we get ECONNRESET
When acting as acceptors for pairing and doing reverse SDP we might get ECONNRESET if the remote device drops the ACL just as we're starting our SDP connect. This patch adds a second SDP connect attempt if we get this specific error.
-rw-r--r--src/device.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/device.c b/src/device.c
index 1f1898ac..48ac512c 100644
--- a/src/device.c
+++ b/src/device.c
@@ -125,6 +125,7 @@ struct browse_req {
GSList *profiles_removed;
sdp_list_t *records;
int search_uuid;
+ int reconnect_attempt;
};
static uint16_t uuid_list[] = {
@@ -1301,8 +1302,13 @@ static void browse_cb(sdp_list_t *recs, int err, gpointer user_data)
/* If we have a valid response and req->search_uuid == 2, then L2CAP
* UUID & PNP searching was successful -- we are done */
- if (err < 0 || (req->search_uuid == 2 && req->records))
- goto done;
+ if (err < 0 || (req->search_uuid == 2 && req->records)) {
+ if (err == -ECONNRESET && req->reconnect_attempt < 1) {
+ req->search_uuid--;
+ req->reconnect_attempt++;
+ } else
+ goto done;
+ }
update_services(req, recs);