Commit 281a2ea6 authored by Sonny Sasaka's avatar Sonny Sasaka Committed by Commit Bot

Don't log as error when Stop() discovery failure is expected

This is a continuation from crosreview.com/737056. When Stop() discovery
fails because Discovering property changes to false, that means all the
discovery sessions have been stopped bluez, so Stop() is expected to
fail and there is no need to log this as error.

BUG=777953
TEST=Reproduce the case and check that device event log is categorized
as DEBUG instead of ERROR.

Change-Id: I41f6e3e83e9f6377bf28f4bb2210be34bdf1c732
Reviewed-on: https://chromium-review.googlesource.com/747603Reviewed-by: default avatarMiao-chen Chou <mcchou@chromium.org>
Commit-Queue: Sonny Sasaka <sonnysasaka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#513022}
parent 667c8da0
......@@ -1602,10 +1602,6 @@ void BluetoothAdapterBlueZ::OnStopDiscoveryError(
const DiscoverySessionErrorCallback& error_callback,
const std::string& error_name,
const std::string& error_message) {
BLUETOOTH_LOG(ERROR) << object_path_.value()
<< ": Failed to stop discovery: " << error_name << ": "
<< error_message;
// Failed to stop discovery. This can only happen if the count is at 1.
DCHECK(discovery_request_pending_);
DCHECK_EQ(num_discovery_sessions_, 1);
......@@ -1616,6 +1612,15 @@ void BluetoothAdapterBlueZ::OnStopDiscoveryError(
force_deactivate_discovery_ = false;
num_discovery_sessions_ = 0;
MarkDiscoverySessionsAsInactive();
// Do not consider this situation as error as the error from Stop()
// discovery session was expected. So log with DEBUG instead of ERROR.
BLUETOOTH_LOG(DEBUG) << object_path_.value()
<< ": Failed to stop discovery: " << error_name << ": "
<< error_message;
} else {
BLUETOOTH_LOG(ERROR) << object_path_.value()
<< ": Failed to stop discovery: " << error_name << ": "
<< error_message;
}
error_callback.Run(TranslateDiscoveryErrorToUMA(error_name));
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment