summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-02-17 13:08:27 +0000
committerErik Johnston <erik@matrix.org>2015-02-17 13:13:14 +0000
commit02bfa889de1990eb8dc47770834bef777252dc82 (patch)
tree5a6c431ff7cb2d3698450de5a47ccbac4efa4369
parentWe do want to consumeError (diff)
downloadsynapse-02bfa889de1990eb8dc47770834bef777252dc82.tar.xz
Handle recieving failures in transactions
-rw-r--r--synapse/federation/federation_server.py13
1 files changed, 12 insertions, 1 deletions
diff --git a/synapse/federation/federation_server.py b/synapse/federation/federation_server.py
index e94d0411b4..34f5b17446 100644
--- a/synapse/federation/federation_server.py
+++ b/synapse/federation/federation_server.py
@@ -114,7 +114,15 @@ class FederationServer(FederationBase):
         with PreserveLoggingContext():
             dl = []
             for pdu in pdu_list:
-                dl.append(self._handle_new_pdu(transaction.origin, pdu))
+                d = self._handle_new_pdu(transaction.origin, pdu)
+
+                def handle_failure(failure):
+                    failure.trap(FederationError)
+                    self.enqueue_failure(failure.value, transaction.origin)
+
+                d.addErrback(handle_failure)
+
+                dl.append(d)
 
             if hasattr(transaction, "edus"):
                 for edu in [Edu(**x) for x in transaction.edus]:
@@ -124,6 +132,9 @@ class FederationServer(FederationBase):
                         edu.content
                     )
 
+            for failure in getattr(transaction, "failures", []):
+                logger.info("Got failure %r", failure)
+
             results = yield defer.DeferredList(dl, consumeErrors=True)
 
         ret = []