def unthrottle_connections(self): self.throttled = False for c in iter_rand_pos(self.connectors): c.connection.resume_reading() # arg. resume actually flushes the buffers in iocpreactor, so # we have to check the state constantly if self.throttled: break
def unthrottle(self): #log( "unthrottle" ) for l in iter_rand_pos(self._throttle_listeners): l.unthrottle_connections() # arg. resume actually flushes the buffers in iocpreactor, so we # have to check the state constantly if self._token_bucket <= 0: break
def throttle_connections(self): self.throttled = True for c in iter_rand_pos(self.connectors): c.connection.pause_reading()
def throttle(self): #log( "throttle" ) for l in iter_rand_pos(self._throttle_listeners): l.throttle_connections()