mirror of
https://github.com/markqvist/Reticulum.git
synced 2026-10-26 10:51:49 -04:00
Added HWM limit option to TransmitBuffer
This commit is contained in:
parent
10848b7cff
commit
cb9071b478
1 changed files with 5 additions and 1 deletions
|
|
@ -63,8 +63,10 @@ class TransmitBuffer:
|
|||
|
||||
# Queue a finalized and complete on-wire frame.
|
||||
# Executed by producer side only.
|
||||
def append(self, frame):
|
||||
def append(self, frame, limit=None):
|
||||
with self._tail_lock:
|
||||
if limit is not None and (self._tx_total - self._tx_sent) + len(frame) > limit: return False
|
||||
|
||||
# Allocate separate chunks to frames
|
||||
# larger than the coalescing target.
|
||||
if len(frame) >= self.COALESCE_TARGET:
|
||||
|
|
@ -91,6 +93,8 @@ class TransmitBuffer:
|
|||
# sparse traffic does not incur coalescing latency.
|
||||
self._flush()
|
||||
|
||||
return True
|
||||
|
||||
def _flush(self):
|
||||
if self._cur is not None and len(self._cur) > 0:
|
||||
self._chunks.append((self._cur, self._cur_frames))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue