Skip to content

Commit

Permalink
dashboard/moninj: fix windows problems
Browse files Browse the repository at this point in the history
sbourdeauducq committed Apr 11, 2016
1 parent d9e918b commit dbba41b
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion artiq/dashboard/moninj.py
Original file line number Diff line number Diff line change
@@ -275,6 +275,7 @@ def __init__(self):
self.subscriber = Subscriber("devices", self.init_devices)
self.dm = None
self.socket = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
self.socket.bind(("", 39284))
# Never ceasing to disappoint, asyncio has an issue about UDP
# not being supported on Windows (ProactorEventLoop) open since 2014.
self.loop = asyncio.get_event_loop()
@@ -305,8 +306,13 @@ async def stop(self):

def receiver_thread(self):
while True:
data, addr = self.socket.recvfrom(2048)
try:
data, addr = self.socket.recvfrom(2048)
except OSError:
# Windows does this when the socket is terminated
break
if addr is None:
# Linux does this when the socket is terminated
break
self.loop.call_soon_threadsafe(self.datagram_received, data)

0 comments on commit dbba41b

Please sign in to comment.