From 0cd8e651b6f004bcc64387d59f6bcb29190ffed6 Mon Sep 17 00:00:00 2001 From: Johan Hedberg Date: Wed, 18 Mar 2009 20:50:51 +0200 Subject: 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. --- src/device.c | 10 ++++++++-- 1 file 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); -- cgit