Browse Source

this error should be asyncio.TimeoutError, make retries faster...

Turns out that the base TimeoutError is different than the asyncio
version, and so we weren't actually retrying packets, just terminating
early...
irr_shared
John-Mark Gurney 3 years ago
parent
commit
d55589790a
1 changed files with 4 additions and 4 deletions
  1. +4
    -4
      lora.py

+ 4
- 4
lora.py View File

@@ -77,7 +77,7 @@ class LORANode(object):
origstate = self.st.copy()

while True:
resp = await self.sd.sendtillrecv(msg, 1)
resp = await self.sd.sendtillrecv(msg, .25)
#_debprint('got:', resp)

# skip empty messages
@@ -133,7 +133,7 @@ class SyncDatagram(object):
async def recv(self, timeout=None): #pragma: no cover
'''Receive a datagram. If timeout is not None, wait that many
seconds, and if nothing is received in that time, raise an
TimeoutError exception.'''
asyncio.TimeoutError exception.'''

raise NotImplementedError

@@ -151,7 +151,7 @@ class SyncDatagram(object):
await self.send(data)
try:
return await self.recv(freq)
except TimeoutError:
except asyncio.TimeoutError:
pass

class MulticastSyncDatagram(SyncDatagram):
@@ -340,7 +340,7 @@ class TestSyncData(unittest.IsolatedAsyncioTestCase):
class MySync(SyncDatagram):
def __init__(self):
self.sendq = []
self.resp = [ TimeoutError(), b'a' ]
self.resp = [ asyncio.TimeoutError(), b'a' ]

async def recv(self, timeout=None):
assert timeout == 1


Loading…
Cancel
Save