flip around 'if' logic to simplify

This commit is contained in:
meejah 2021-04-02 23:36:33 -06:00
parent f3c391e98b
commit fc3507c1f6

View File

@ -84,14 +84,14 @@ class TransitConnection(LineReceiver):
# point the sender will only transmit data as fast as the # point the sender will only transmit data as fast as the
# receiver can handle it. # receiver can handle it.
if self._sent_ok: if self._sent_ok:
if not self._buddy: # if self._buddy is None then our buddy disconnected
# Our buddy disconnected (we're "jilted"), so we hung up too, # (we're "jilted"), so we hung up too, but our incoming
# but our incoming data hasn't stopped yet (it will in a # data hasn't stopped yet (it will in a moment, after our
# moment, after our disconnect makes a roundtrip through the # disconnect makes a roundtrip through the kernel). This
# kernel). This probably means the file receiver hung up, and # probably means the file receiver hung up, and this
# this connection is the file sender. In may-2020 this # connection is the file sender. In may-2020 this happened
# happened 11 times in 40 days. # 11 times in 40 days.
return if self._buddy:
self._total_sent += len(data) self._total_sent += len(data)
self._buddy.transport.write(data) self._buddy.transport.write(data)
return return