Killed a couple of allocs, canonical HDLC frame method

This commit is contained in:
Mark Qvist 2026-09-01 14:45:54 +02:00
parent ea98db4f53
commit eb8414bee9
No known key found for this signature in database
3 changed files with 12 additions and 3 deletions

View file

@ -218,7 +218,7 @@ class LocalClientInterface(Interface):
if self.online:
try:
if self.epoll_backend:
frame = bytes([HDLC.FLAG])+HDLC.escape(data)+bytes([HDLC.FLAG])
frame = HDLC.frame(data)
if self.tx_stalled or not self.transmit_buffer.append(frame, self.tx_hwm):
self.tx_drops += 1
self.tx_dropped_bytes += len(frame)
@ -235,7 +235,7 @@ class LocalClientInterface(Interface):
s = len(data) / self.bitrate * 8
time.sleep(s)
data = bytes([HDLC.FLAG])+HDLC.escape(data)+bytes([HDLC.FLAG])
data = HDLC.frame(data)
self.socket.sendall(data)
self.writing = False
self.txb += len(data)