You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In src/emanesh/emanesh/events/eventservice.py, EventService.nextEvent() does not currently break when EventService.breakloop() is called. This is different than how EventService.loop() behaves and makes it difficult to gracefully interrupt a call to nextEvent().
One option could be something like the following patch (based on the develop branch), which also removes the unused 'running' variable:
--- a/src/emanesh/emanesh/events/eventservice.py
+++ b/src/emanesh/emanesh/events/eventservice.py
@@ -238,7 +238,6 @@ class EventService:
data,_ = self._socket.recvfrom(65535)
if not len(data):
- running = False
break
(length,) = struct.unpack_from("!H",data)
@@ -257,11 +256,13 @@ class EventService:
event.sequenceNumber,
tuple(events))
+ elif fd is self._readFd:
+ break
+
elif fd is self._socketOTA:
data,_ = self._socketOTA.recvfrom(65535)
if not len(data):
- running = False
break
(headerLength,) = struct.unpack_from("!H",data)
@@ -283,6 +284,7 @@ class EventService:
otaHeader.sequenceNumber,
tuple(events))
+ return (None, None, tuple(events))
def subscribe(self,eventId,callback):
self._lock.acquire()
The text was updated successfully, but these errors were encountered:
breakloop(). Added missing logic to use internal pipe to signal
getNext() to return. On cancel via breakloop() or on a socket read
error, getNext() will return (None,None,()) for the UUID, sequence
number and event data, respectively.
Submitted-by: Tom Goff <https://github.com/tomgoff>
See #30
In src/emanesh/emanesh/events/eventservice.py, EventService.nextEvent() does not currently break when EventService.breakloop() is called. This is different than how EventService.loop() behaves and makes it difficult to gracefully interrupt a call to nextEvent().
One option could be something like the following patch (based on the develop branch), which also removes the unused 'running' variable:
The text was updated successfully, but these errors were encountered: