diff options
author | Erik Johnston <erik@matrix.org> | 2014-09-18 13:05:07 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2014-09-18 13:05:07 +0100 |
commit | 704e7e9f44bb6ac4de03e47fd9276396d3c00af9 (patch) | |
tree | 2b3f49347cb9615bdacf276a8b786243aa16d324 /synapse/federation/transport.py | |
parent | freenode verification (diff) | |
parent | Merge branch 'develop' of github.com:matrix-org/synapse into release-v0.3.0 (diff) | |
download | synapse-704e7e9f44bb6ac4de03e47fd9276396d3c00af9.tar.xz |
Merge branch 'release-v0.3.0' of github.com:matrix-org/synapse v0.3.0
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( |