restore impatient disconnect when message received after handshake but before sent_ok
This commit is contained in:
parent
8f89c8aaff
commit
0dab7a4c63
|
@ -74,14 +74,22 @@ class TransitConnection(LineReceiver):
|
||||||
return self.disconnect_error()
|
return self.disconnect_error()
|
||||||
|
|
||||||
def rawDataReceived(self, data):
|
def rawDataReceived(self, data):
|
||||||
|
# We are an IPushProducer to our buddy's IConsumer, so they'll
|
||||||
|
# throttle us (by calling pauseProducing()) when their outbound
|
||||||
|
# buffer is full (e.g. when their downstream pipe is full). In
|
||||||
|
# practice, this buffers about 10MB per connection, after which
|
||||||
|
# point the sender will only transmit data as fast as the
|
||||||
|
# receiver can handle it.
|
||||||
if self._sent_ok:
|
if self._sent_ok:
|
||||||
self._total_sent += len(data)
|
self._total_sent += len(data)
|
||||||
self._buddy.transport.write(data)
|
self._buddy.transport.write(data)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# handshake is complete but not yet sent_ok
|
||||||
self.sendLine(b"impatient")
|
self.sendLine(b"impatient")
|
||||||
if self._log_requests:
|
if self._log_requests:
|
||||||
log.msg("transit impatience failure")
|
log.msg("transit impatience failure")
|
||||||
|
return self.disconnect_error() # impatience yields failure
|
||||||
|
|
||||||
def _got_handshake(self, token, side):
|
def _got_handshake(self, token, side):
|
||||||
self._got_token = token
|
self._got_token = token
|
||||||
|
|
Loading…
Reference in New Issue
Block a user