dbus: Don't DCHECK unexpected message type, but ignore it
In dbus::ExportedObject, an assumption was made that no signal could be
received for an exported object, so DCHECK was put there. Now that there
is a use case of D-Bus forwarding by Bluetooth dispatcher, it is fine
that an exported object receives D-Bus signal messages as it is a
property change signal that is handled by dbus::ObjectManager. So we can
just ignore message types other than method in dbus::ExportedObject
rather than DCHECK it.
BUG=835457
Change-Id: Icae03881052b3d7365a9017e5f2b987a058cd356
Reviewed-on: https://chromium-review.googlesource.com/1027081
Reviewed-by: Ryo Hashimoto <hashimoto@chromium.org>
Reviewed-by: Satoru Takabayashi <satorux@google.com>
Commit-Queue: Sonny Sasaka <sonnysasaka@chromium.org>
Cr-Commit-Position: refs/heads/master@{#553639}
CrOS-Libchrome-Original-Commit: a3f2862214239a61f3c8557d80a17f26f84e2133
diff --git a/dbus/exported_object.cc b/dbus/exported_object.cc
index aa6a7c8..47c70ff 100644
--- a/dbus/exported_object.cc
+++ b/dbus/exported_object.cc
@@ -191,7 +191,10 @@
DBusConnection* connection,
DBusMessage* raw_message) {
bus_->AssertOnDBusThread();
- DCHECK_EQ(DBUS_MESSAGE_TYPE_METHOD_CALL, dbus_message_get_type(raw_message));
+ // ExportedObject only handles method calls. Ignore other message types (e.g.
+ // signal).
+ if (dbus_message_get_type(raw_message) != DBUS_MESSAGE_TYPE_METHOD_CALL)
+ return DBUS_HANDLER_RESULT_NOT_YET_HANDLED;
// raw_message will be unrefed on exit of the function. Increment the
// reference so we can use it in MethodCall.