Checking if we should enable write buffer should be in _fill_throttle()
This commit is contained in:
parent
23d2993b9f
commit
1f1b63ea6d
1 changed files with 5 additions and 6 deletions
|
@ -129,8 +129,12 @@ class Socket(IRCObject.Object):
|
||||||
else:
|
else:
|
||||||
self._queued_lines.append(line)
|
self._queued_lines.append(line)
|
||||||
|
|
||||||
|
|
||||||
def _fill_throttle(self):
|
def _fill_throttle(self):
|
||||||
|
if not self._write_buffer and self._throttle_when_empty:
|
||||||
|
self._throttle_when_empty = False
|
||||||
|
self._write_throttling = True
|
||||||
|
self._recent_sends.clear()
|
||||||
|
|
||||||
throttle_space = self.throttle_space()
|
throttle_space = self.throttle_space()
|
||||||
if throttle_space:
|
if throttle_space:
|
||||||
to_buffer = self._queued_lines[:throttle_space]
|
to_buffer = self._queued_lines[:throttle_space]
|
||||||
|
@ -139,11 +143,6 @@ class Socket(IRCObject.Object):
|
||||||
self._immediate_buffer(line)
|
self._immediate_buffer(line)
|
||||||
|
|
||||||
def _send(self) -> typing.List[IRCLine.SentLine]:
|
def _send(self) -> typing.List[IRCLine.SentLine]:
|
||||||
if not self._write_buffer and self._throttle_when_empty:
|
|
||||||
self._throttle_when_empty = False
|
|
||||||
self._write_throttling = True
|
|
||||||
self._recent_sends.clear()
|
|
||||||
|
|
||||||
bytes_written_i = self._socket.send(self._write_buffer)
|
bytes_written_i = self._socket.send(self._write_buffer)
|
||||||
bytes_written = self._write_buffer[:bytes_written_i]
|
bytes_written = self._write_buffer[:bytes_written_i]
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue