summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-02-11 09:22:37 +0000
committerErik Johnston <erik@matrix.org>2016-02-11 09:22:37 +0000
commita1b79029443c2edabd90ec3cd372443b44079c8e (patch)
treea530dbda498998b4a32e3a174488e0d1fadb8d54
parentMerge branch 'master' of github.com:matrix-org/synapse into develop (diff)
downloadsynapse-a1b79029443c2edabd90ec3cd372443b44079c8e.tar.xz
Add some paranoia logging
-rw-r--r--synapse/rest/client/v2_alpha/sync.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/rest/client/v2_alpha/sync.py b/synapse/rest/client/v2_alpha/sync.py
index 140ce2704b..accbc6cfac 100644
--- a/synapse/rest/client/v2_alpha/sync.py
+++ b/synapse/rest/client/v2_alpha/sync.py
@@ -28,6 +28,7 @@ from synapse.api.errors import SynapseError
 from ._base import client_v2_patterns
 
 import copy
+import itertools
 import logging
 
 import ujson as json
@@ -288,6 +289,15 @@ class SyncRestServlet(RestServlet):
 
         state_events = state_dict.values()
 
+        for event in itertools.chain(state_events, timeline_events):
+            # We've had bug reports that events were coming down under the
+            # wrong room.
+            if event.room_id != room.room_id:
+                logger.warn(
+                    "Event %r is under room %r instead of %r",
+                    event.event_id, room.room_id, event.room_id,
+                )
+
         serialized_state = [serialize(e) for e in state_events]
         serialized_timeline = [serialize(e) for e in timeline_events]