summary refs log tree commit diff
path: root/synapse/federation
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2014-11-25 11:31:18 +0000
committerErik Johnston <erik@matrix.org>2014-11-25 17:59:49 +0000
commit64fc859dac122a44a753eafe015a453085e6e9a8 (patch)
tree056658b4941cbc6a32159d4e86c455c0e6a8efe4 /synapse/federation
parentDon't double url-decode state event types. (diff)
downloadsynapse-64fc859dac122a44a753eafe015a453085e6e9a8.tar.xz
Fix bugs in invite/join dances.
We now do more implement more of the auth on the events so that we
don't reject valid events.
Diffstat (limited to 'synapse/federation')
-rw-r--r--synapse/federation/replication.py42
1 files changed, 31 insertions, 11 deletions
diff --git a/synapse/federation/replication.py b/synapse/federation/replication.py
index fa2463d4a3..89c0ef49e9 100644
--- a/synapse/federation/replication.py
+++ b/synapse/federation/replication.py
@@ -481,11 +481,17 @@ class ReplicationLayer(object):
         # FIXME: We probably want to do something with the auth_chain given
         # to us
 
-        # auth_chain = [
-        #    Pdu(outlier=True, **p) for p in content.get("auth_chain", [])
-        # ]
+        auth_chain = [
+            self.event_from_pdu_json(p, outlier=True)
+            for p in content.get("auth_chain", [])
+        ]
 
-        defer.returnValue(state)
+        auth_chain.sort(key=lambda e: e.depth)
+
+        defer.returnValue({
+            "state": state,
+            "auth_chain": auth_chain,
+        })
 
     @defer.inlineCallbacks
     def send_invite(self, destination, context, event_id, pdu):
@@ -551,12 +557,26 @@ class ReplicationLayer(object):
             )
 
             if not exists:
-                yield self.get_pdu(
-                    origin,
-                    event_id=e_id,
-                    outlier=True,
-                )
-                logger.debug("Processed pdu %s", e_id)
+                try:
+                    logger.debug(
+                        "Getting missing auth event %s from %s",
+                        e_id,
+                        origin,
+                    )
+
+                    yield self.get_pdu(
+                        origin,
+                        event_id=e_id,
+                        outlier=True,
+                    )
+
+                    logger.debug("Processed pdu %s", e_id)
+                except:
+                    logger.warn(
+                        "Failed to get auth event %s from %s",
+                        e_id,
+                        origin
+                    )
 
         # Get missing pdus if necessary.
         if not pdu.outlier:
@@ -578,7 +598,7 @@ class ReplicationLayer(object):
 
                         try:
                             yield self.get_pdu(
-                                pdu.origin,
+                                origin,
                                 event_id=event_id,
                             )
                             logger.debug("Processed pdu %s", event_id)