summaryrefslogtreecommitdiffstats
path: root/dbus
diff options
context:
space:
mode:
authorsatorux <satorux@chromium.org>2015-08-17 02:44:35 -0700
committerCommit bot <commit-bot@chromium.org>2015-08-17 09:45:09 +0000
commit9b780e6bfc08404de90339c76ece4457cb1734bc (patch)
tree753fb943ad7cf9d1586c6fc67765c9375adff0dd /dbus
parentd1fa1c00b653826690d2e5692c28549fcdb7d62f (diff)
downloadchromium_src-9b780e6bfc08404de90339c76ece4457cb1734bc.zip
chromium_src-9b780e6bfc08404de90339c76ece4457cb1734bc.tar.gz
chromium_src-9b780e6bfc08404de90339c76ece4457cb1734bc.tar.bz2
dbus: Suppress "Rejecting a message from a wrong sender" error from ObjectManager
The error message was a false alarm that was polluting the log file. ObjectManager::HandleMessage() is called for *every instance of ObjectManager* whenever a message is delivered. It's the right thing for an ObjectManager instance to ignore a signal that the instance is not interested in. Note that the service owner name change is handled via ObjectManager::NameOwnerChanged(), that's set up in the ObjectManager's constructor hence ObjectManager can handle name owner changes. BUG=507206 TEST=enable/disable Bluetooth and confirm that the error message is no longer emitted in the log file. Review URL: https://codereview.chromium.org/1297903002 Cr-Commit-Position: refs/heads/master@{#343656}
Diffstat (limited to 'dbus')
-rw-r--r--dbus/object_manager.cc19
1 files changed, 13 insertions, 6 deletions
diff --git a/dbus/object_manager.cc b/dbus/object_manager.cc
index 851fee4..3f253fa 100644
--- a/dbus/object_manager.cc
+++ b/dbus/object_manager.cc
@@ -252,6 +252,9 @@ DBusHandlerResult ObjectManager::HandleMessage(DBusConnection* connection,
DCHECK(bus_);
bus_->AssertOnDBusThread();
+ // Handle the message only if it is a signal.
+ // Note that the match rule in SetupMatchRuleAndFilter() is configured to
+ // only accept signals, but we check here just in case.
if (dbus_message_get_type(raw_message) != DBUS_MESSAGE_TYPE_SIGNAL)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
@@ -266,7 +269,9 @@ DBusHandlerResult ObjectManager::HandleMessage(DBusConnection* connection,
statistics::AddReceivedSignal(service_name_, interface, member);
- // Only handle the PropertiesChanged signal.
+ // Handle the signal only if it is PropertiesChanged.
+ // Note that the match rule in SetupMatchRuleAndFilter() is configured to
+ // only accept PropertiesChanged signals, but we check here just in case.
const std::string absolute_signal_name =
GetAbsoluteMemberName(interface, member);
const std::string properties_changed_signal_name =
@@ -276,13 +281,15 @@ DBusHandlerResult ObjectManager::HandleMessage(DBusConnection* connection,
VLOG(1) << "Signal received: " << signal->ToString();
- // Make sure that the signal originated from the correct sender.
+ // Handle the signal only if it is from the service that the ObjectManager
+ // instance is interested in.
+ // Note that the match rule in SetupMatchRuleAndFilter() is configured to
+ // only accept messages from the service name of our interest. However, the
+ // service='...' filter does not work as intended. See crbug.com/507206#14
+ // and #15 for details, hence it's necessary to check the sender here.
std::string sender = signal->GetSender();
- if (service_name_owner_ != sender) {
- LOG(ERROR) << "Rejecting a message from a wrong sender.";
- UMA_HISTOGRAM_COUNTS("DBus.RejectedSignalCount", 1);
+ if (service_name_owner_ != sender)
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
const ObjectPath path = signal->GetPath();