mirror of
https://github.com/markqvist/Reticulum
synced 2026-11-22 23:10:32 +00:00
Added HWM limit option to TransmitBuffer
This commit is contained in:
1 file changed
+5
-1
@@ -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))
|
||||
|
||||
Reference in new issue
Block a user