1
0

PaddedRSTransport: fix busy loop in poll_sbuffer (follow-up 43ca469774)

According to the asyncio documentation:

> When a task is cancelled, asyncio.CancelledError will be raised in the task at the next opportunity.

I guess the 'next opportunity' means the next await statement.
Here the issue is that the task was not awaiting ever.

Note: ElectrumX needs a similar patch
This commit is contained in:
ThomasV
2025-06-02 13:22:32 +02:00
parent c8ea5b6173
commit 0ce89b6d54

View File

@@ -359,7 +359,7 @@ class PaddedRSTransport(RSTransport):
self._sbuffer_has_data_evt.clear()
async def _poll_sbuffer(self):
while True:
while not self.is_closing():
await self._sbuffer_has_data_evt.wait() # to avoid busy-waiting
self._maybe_consume_sbuffer()
# If there is still data in the buffer, sleep until it would time out.