summary refs log tree commit diff
path: root/synapse/federation/sender/transaction_manager.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2019-09-05 17:27:46 +0100
committerErik Johnston <erik@matrix.org>2019-09-05 17:27:46 +0100
commit591d82f06b81738efe67c13cdeee0901c3b28946 (patch)
tree018ec1d3caaa956d2173e9b11c74f78619aba0de /synapse/federation/sender/transaction_manager.py
parentFix test (diff)
parentMerge pull request #5984 from matrix-org/joriks/opentracing_link_send_to_edu_... (diff)
downloadsynapse-591d82f06b81738efe67c13cdeee0901c3b28946.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into erikj/censor_redactions
Diffstat (limited to 'synapse/federation/sender/transaction_manager.py')
-rw-r--r--synapse/federation/sender/transaction_manager.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/synapse/federation/sender/transaction_manager.py b/synapse/federation/sender/transaction_manager.py
index 62ca6a3e87..5b6c79c51a 100644
--- a/synapse/federation/sender/transaction_manager.py
+++ b/synapse/federation/sender/transaction_manager.py
@@ -26,6 +26,7 @@ from synapse.logging.opentracing import (
     set_tag,
     start_active_span_follows_from,
     tags,
+    whitelisted_homeserver,
 )
 from synapse.util.metrics import measure_func
 
@@ -59,9 +60,15 @@ class TransactionManager(object):
         # The span_contexts is a generator so that it won't be evaluated if
         # opentracing is disabled. (Yay speed!)
 
-        span_contexts = (
-            extract_text_map(json.loads(edu.get_context())) for edu in pending_edus
-        )
+        span_contexts = []
+        keep_destination = whitelisted_homeserver(destination)
+
+        for edu in pending_edus:
+            context = edu.get_context()
+            if context:
+                span_contexts.append(extract_text_map(json.loads(context)))
+            if keep_destination:
+                edu.strip_context()
 
         with start_active_span_follows_from("send_transaction", span_contexts):