diff options
author | Mark Haines <mark.haines@matrix.org> | 2014-09-22 18:54:00 +0100 |
---|---|---|
committer | Mark Haines <mark.haines@matrix.org> | 2014-09-22 18:54:00 +0100 |
commit | 09d79b0a9bf7a194383830d2e55530c70f2366b6 (patch) | |
tree | 76573bac3ca48deeca6cd33f91ed2ee3408dffb2 /synapse/federation/transport.py | |
parent | SYN-39: Add documentation explaining how to check a signature (diff) | |
parent | Show display name changes in the message list. (diff) | |
download | synapse-09d79b0a9bf7a194383830d2e55530c70f2366b6.tar.xz |
Merge branch 'develop' into server2server_signing
Diffstat (limited to 'synapse/federation/transport.py')
-rw-r--r-- | synapse/federation/transport.py | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/synapse/federation/transport.py b/synapse/federation/transport.py index 6e62ae7c74..afc777ec9e 100644 --- a/synapse/federation/transport.py +++ b/synapse/federation/transport.py @@ -144,7 +144,7 @@ class TransportLayer(object): @defer.inlineCallbacks @log_function - def send_transaction(self, transaction): + def send_transaction(self, transaction, on_send_callback=None): """ Sends the given Transaction to it's destination Args: @@ -165,10 +165,23 @@ class TransportLayer(object): data = transaction.get_dict() + # FIXME (erikj): This is a bit of a hack to make the Pdu age + # keys work + def cb(destination, method, path_bytes, producer): + if not on_send_callback: + return + + transaction = json.loads(producer.body) + + new_transaction = on_send_callback(transaction) + + producer.reset(new_transaction) + code, response = yield self.client.put_json( transaction.destination, path=PREFIX + "/send/%s/" % transaction.transaction_id, - data=data + data=data, + on_send_callback=cb, ) logger.debug( |