1From ad887b5aaf4f834dbbd487adfe89d9a5b3d673f2 Mon Sep 17 00:00:00 2001 2From: Sonny Sasaka <[email protected]> 3Date: Thu, 9 Aug 2018 22:39:57 +0000 4Subject: [PATCH] dbus: Remove LOG(ERROR) in ObjectProxy 5 6It is a valid use case for a daemon to have multiple ObjectProxies of 7different services with the exact same object path and interface name. 8Currently, this may cause log pollution of "rejecting a message from a 9wrong sender" because one ObjectProxy receives signals intended for 10another ObjectProxy. Since it's actually a valid case and not a bug, it 11shouldn't be logged as error but it may still be logged with VLOG. 12 13Currently this is discovered in Bluetooth daemon (btdispatch) because it 14listens to both BlueZ's and Newblue's objects which have identical 15object paths and interfaces. 16 17Bug: 866704 18Change-Id: I25b6437ec6081e244a47c635c0adedf281530967 19Reviewed-on: https://chromium-review.googlesource.com/1164474 20Reviewed-by: Ryo Hashimoto <[email protected]> 21Commit-Queue: Sonny Sasaka <[email protected]> 22Cr-Commit-Position: refs/heads/master@{#581937} 23--- 24 dbus/object_proxy.cc | 11 +++++------ 25 1 file changed, 5 insertions(+), 6 deletions(-) 26 27diff --git a/dbus/object_proxy.cc b/dbus/object_proxy.cc 28index 35835fbdc32c..aa5102aec792 100644 29--- a/dbus/object_proxy.cc 30+++ b/dbus/object_proxy.cc 31@@ -519,6 +519,11 @@ DBusHandlerResult ObjectProxy::HandleMessage( 32 return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; 33 } 34 35+ std::string sender = signal->GetSender(); 36+ // Ignore message from sender we are not interested in. 37+ if (service_name_owner_ != sender) 38+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; 39+ 40 const std::string interface = signal->GetInterface(); 41 const std::string member = signal->GetMember(); 42 43@@ -534,12 +539,6 @@ DBusHandlerResult ObjectProxy::HandleMessage( 44 } 45 VLOG(1) << "Signal received: " << signal->ToString(); 46 47- std::string sender = signal->GetSender(); 48- if (service_name_owner_ != sender) { 49- LOG(ERROR) << "Rejecting a message from a wrong sender."; 50- return DBUS_HANDLER_RESULT_NOT_YET_HANDLED; 51- } 52- 53 const base::TimeTicks start_time = base::TimeTicks::Now(); 54 if (bus_->HasDBusThread()) { 55 // Post a task to run the method in the origin thread. 56-- 572.21.0.392.gf8f6787159e-goog 58 59