Commit aea18481 authored by Sonny Sasaka's avatar Sonny Sasaka Committed by Commit Bot

dbus: Filter signal by the sender we are interested in only.

This adds sender='<name>' filter as the match rule for subscribing to
signal in ObjectProxy. This is needed to reduce the unnecessary polluted
log of rejecting some signals. The manual sender verification is still
needed because as mentioned in
https://bugs.chromium.org/p/chromium/issues/detail?id=507206#c14
service_name_ might be empty and sender='' means to not filter by sender
at all.

BUG=chromium:812468
TEST=Tested on device and checked that communications to D-Bus services
(e.g. power, bluetooth) don't break

Change-Id: I0ef4e03b5d9d8aa4412ef97286b971c30f458e99
Reviewed-on: https://chromium-review.googlesource.com/958324Reviewed-by: default avatarSatoru Takabayashi <satorux@chromium.org>
Commit-Queue: Sonny Sasaka <sonnysasaka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#542567}
parent abd42592
...@@ -463,9 +463,9 @@ bool ObjectProxy::ConnectToSignalInternal(const std::string& interface_name, ...@@ -463,9 +463,9 @@ bool ObjectProxy::ConnectToSignalInternal(const std::string& interface_name,
GetAbsoluteMemberName(interface_name, signal_name); GetAbsoluteMemberName(interface_name, signal_name);
// Add a match rule so the signal goes through HandleMessage(). // Add a match rule so the signal goes through HandleMessage().
const std::string match_rule = const std::string match_rule = base::StringPrintf(
base::StringPrintf("type='signal', interface='%s', path='%s'", "type='signal', sender='%s', interface='%s', path='%s'",
interface_name.c_str(), service_name_.c_str(), interface_name.c_str(),
object_path_.value().c_str()); object_path_.value().c_str());
return AddMatchRuleWithCallback(match_rule, return AddMatchRuleWithCallback(match_rule,
absolute_signal_name, absolute_signal_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