cmd_send: wait for ack from close()

Without this, the sender drops the connection before the "close" message
has made it to the server, which leaves the mailbox hanging until it
expires. It still lives in a 'd.addBoth()' slot, so it gets closed even
if some error occurrs, but we wait for it's Deferred to fire in both
success and failure cases.
This commit is contained in:
Brian Warner 2016-06-26 11:46:09 -07:00
parent 1d3b22a0b4
commit de8efdb9f9

View File

@ -48,10 +48,9 @@ class Sender:
w = wormhole(APPID, self._args.relay_url,
self._reactor, self._tor_manager,
timing=self._timing)
try:
yield self._go(w)
finally:
w.close()
d = self._go(w)
d.addBoth(w.close) # must wait for ack from close()
yield d
def _send_data(self, data, w):
data_bytes = dict_to_bytes(data)