You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

59 lines
2.2 KiB

From ad887b5aaf4f834dbbd487adfe89d9a5b3d673f2 Mon Sep 17 00:00:00 2001
From: Sonny Sasaka <sonnysasaka@chromium.org>
Date: Thu, 9 Aug 2018 22:39:57 +0000
Subject: [PATCH] dbus: Remove LOG(ERROR) in ObjectProxy
It is a valid use case for a daemon to have multiple ObjectProxies of
different services with the exact same object path and interface name.
Currently, this may cause log pollution of "rejecting a message from a
wrong sender" because one ObjectProxy receives signals intended for
another ObjectProxy. Since it's actually a valid case and not a bug, it
shouldn't be logged as error but it may still be logged with VLOG.
Currently this is discovered in Bluetooth daemon (btdispatch) because it
listens to both BlueZ's and Newblue's objects which have identical
object paths and interfaces.
Bug: 866704
Change-Id: I25b6437ec6081e244a47c635c0adedf281530967
Reviewed-on: https://chromium-review.googlesource.com/1164474
Reviewed-by: Ryo Hashimoto <hashimoto@chromium.org>
Commit-Queue: Sonny Sasaka <sonnysasaka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#581937}
---
dbus/object_proxy.cc | 11 +++++------
1 file changed, 5 insertions(+), 6 deletions(-)
diff --git a/dbus/object_proxy.cc b/dbus/object_proxy.cc
index 35835fbdc32c..aa5102aec792 100644
--- a/dbus/object_proxy.cc
+++ b/dbus/object_proxy.cc
@@ -519,6 +519,11 @@ DBusHandlerResult ObjectProxy::HandleMessage(
return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
}
+ std::string sender = signal->GetSender();
+ // Ignore message from sender we are not interested in.
+ if (service_name_owner_ != sender)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
+
const std::string interface = signal->GetInterface();
const std::string member = signal->GetMember();
@@ -534,12 +539,6 @@ DBusHandlerResult ObjectProxy::HandleMessage(
}
VLOG(1) << "Signal received: " << signal->ToString();
- std::string sender = signal->GetSender();
- if (service_name_owner_ != sender) {
- LOG(ERROR) << "Rejecting a message from a wrong sender.";
- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
- }
-
const base::TimeTicks start_time = base::TimeTicks::Now();
if (bus_->HasDBusThread()) {
// Post a task to run the method in the origin thread.
--
2.21.0.392.gf8f6787159e-goog