summary refs log tree commit diff
path: root/synapse/handlers
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2020-01-13 15:24:46 +0000
committerErik Johnston <erik@matrix.org>2020-01-13 15:24:46 +0000
commit1bb87fec0cb244bc7bd4886c58d2fdcec5e7b3c7 (patch)
treeec70b0e44de1111a82397dd1b5b9d3b6531ae448 /synapse/handlers
parentNewsfile (diff)
downloadsynapse-1bb87fec0cb244bc7bd4886c58d2fdcec5e7b3c7.tar.xz
Log received 'm.room_key_request' EDUs
Diffstat (limited to 'synapse/handlers')
-rw-r--r--synapse/handlers/devicemessage.py27
1 files changed, 23 insertions, 4 deletions
diff --git a/synapse/handlers/devicemessage.py b/synapse/handlers/devicemessage.py
index 21ea89d279..4a7b2328c1 100644
--- a/synapse/handlers/devicemessage.py
+++ b/synapse/handlers/devicemessage.py
@@ -81,10 +81,29 @@ class DeviceMessageHandler(object):
             }
             local_messages[user_id] = messages_by_device
 
-            # We expect the sending user to send the message to all the devices
-            # to the user, if they don't then that is potentially suspicious and
-            # so we log for debugging purposes.
-            if device_list_debugging_logger.isEnabledFor(logging.INFO):
+            if (
+                device_list_debugging_logger.isEnabledFor(logging.INFO)
+                and message_type == "m.room_key_request"
+            ):
+                # If we get a request to get keys then may mean the recipient
+                # didn't know about the sender's device (or might just mean
+                # things are being a bit slow to propogate).
+                received_devices = set(by_device)
+                sender_key = list(by_device.values())[0].get("sender_key", "<unknown>")
+                device_list_debugging_logger.info(
+                    "Received room_key request direct message (%s, %s) from %s (%s) to %s (%s).",
+                    message_type,
+                    message_id,
+                    sender_user_id,
+                    sender_key,
+                    user_id,
+                    received_devices,
+                )
+            elif device_list_debugging_logger.isEnabledFor(logging.INFO):
+                # We expect the sending user to send the message to all the devices
+                # to the user, if they don't then that is potentially suspicious and
+                # so we log for debugging purposes.
+
                 expected_devices = yield self.store.get_devices_by_user(user_id)
                 expected_devices = set(expected_devices)
                 received_devices = set(by_device)