Skip to content

Commit

Permalink
device/bluetooth: Do not report InProgress error as success
Browse files Browse the repository at this point in the history
Chrome should not interpret InProgress error from bluez's StartDiscovery
as success. The error should be propagated to the caller so that the
caller can retry StartDiscovery.

BUG=738237

Change-Id: Iebaaf1428453fb10b315cb205ec0f313e02e4fed
Reviewed-on: https://chromium-review.googlesource.com/618169
Reviewed-by: Miao-chen Chou <mcchou@chromium.org>
Reviewed-by: Rahul Chaturvedi <rkc@chromium.org>
Commit-Queue: Kyle Horimoto <khorimoto@chromium.org>
Cr-Commit-Position: refs/heads/master@{#496909}
  • Loading branch information
Sonny Sasaka authored and Commit Bot committed Aug 24, 2017
1 parent 39fc78b commit dfa9022
Showing 1 changed file with 1 addition and 12 deletions.
13 changes: 1 addition & 12 deletions device/bluetooth/bluez/bluetooth_adapter_bluez.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1565,18 +1565,7 @@ void BluetoothAdapterBlueZ::OnStartDiscoveryError(
DCHECK(discovery_request_pending_);
discovery_request_pending_ = false;

// Discovery request may fail if discovery was previously initiated by Chrome,
// but the session were invalidated due to the discovery state unexpectedly
// changing to false and then back to true. In this case, report success.
if (IsPresent() && error_name == bluetooth_device::kErrorInProgress &&
IsDiscovering()) {
BLUETOOTH_LOG(DEBUG)
<< "Discovery previously initiated. Reporting success.";
num_discovery_sessions_++;
callback.Run();
} else {
error_callback.Run(TranslateDiscoveryErrorToUMA(error_name));
}
error_callback.Run(TranslateDiscoveryErrorToUMA(error_name));

// Try to add a new discovery session for each queued request.
ProcessQueuedDiscoveryRequests();
Expand Down

0 comments on commit dfa9022

Please sign in to comment.