Skip to content

Commit 3354de3

Browse files
ddkohleruntzag
andauthored
release tcp messages from memory (#92)
* Update _protocol.py * Update CHANGELOG.md * unpacker clears _file itself * cleanup * Update unpacker.py --------- Co-authored-by: Blaise Thompson <blaise@untzag.com>
1 parent b9b4fd2 commit 3354de3

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

yaqd-core/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/).
66
## [Unreleased]
77

88
### Fixed
9+
- daemon servers no longer keep all recieved messages in memory
910
- removed asyncio syntax that was removed in python 3.14
1011
- type hints for IsSensor attributes are appropriate for _n_-dimensional data
1112

yaqd-core/yaqd_core/avrorpc/unpacker.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,11 @@ def feed(self, data: bytes):
7171
# Must support random access, if it does not, must be fed externally (e.g. TCP)
7272
pos = self._file.tell()
7373
self._file.seek(0, 2)
74+
if pos == self._file.tell():
75+
# read reached EOF and we are safe to clear
76+
self._file.seek(0)
77+
self._file.truncate(0)
78+
pos = 0
7479
self._file.write(data)
7580
self._file.seek(pos)
7681
self.new_data.set()

0 commit comments

Comments
 (0)