summary refs log tree commit diff
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-06-24 13:04:37 +0100
committerErik Johnston <erik@matrix.org>2015-06-24 13:04:37 +0100
commitec6ceadeeb861e26c905248fa96091bce4c392a4 (patch)
tree3597cc9d566b6dd163ce0bffc85346d28fcc6e43
parentFix up process_v2_response (diff)
downloadsynapse-ec6ceadeeb861e26c905248fa96091bce4c392a4.tar.xz
Only fail individular deferred for invalid signature
-rw-r--r--synapse/crypto/keyring.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/synapse/crypto/keyring.py b/synapse/crypto/keyring.py
index a35e93f279..2cfec39851 100644
--- a/synapse/crypto/keyring.py
+++ b/synapse/crypto/keyring.py
@@ -64,20 +64,21 @@ class Keyring(object):
         group_ids = []
 
         next_group_id = 0
+        deferreds = {}
 
         for server_name, json_object in server_and_json:
             logger.debug("Verifying for %s", server_name)
+            group_id = next_group_id
+            next_group_id += 1
+            group_ids.append(group_id)
+
             key_ids = signature_ids(json_object, server_name)
             if not key_ids:
-                raise SynapseError(
+                deferreds[group_id] = defer.fail(SynapseError(
                     400,
                     "Not signed with a supported algorithm",
                     Codes.UNAUTHORIZED,
-                )
-
-            group_id = next_group_id
-            next_group_id += 1
-            group_ids.append(group_id)
+                ))
 
             group = KeyGroup(server_name, group_id, key_ids)
 
@@ -124,9 +125,9 @@ class Keyring(object):
                     Codes.UNAUTHORIZED,
                 )
 
-        deferreds = self.get_server_verify_keys(
+        deferreds.update(self.get_server_verify_keys(
             group_id_to_group
-        )
+        ))
 
         logger.info(
             "Deferred count: %d vs. %d",