From: Richard Taylor Date: Thu, 20 Mar 2014 13:54:02 +0000 (+0000) Subject: Catch system interrupt exception when waiting for a connection in the sliceEngine. X-Git-Tag: 14.06~52^2^2 X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?a=commitdiff_plain;h=10ee70b1c8d6128edcc03b7f68e873be0c6608fa;p=cura.git Catch system interrupt exception when waiting for a connection in the sliceEngine. --- diff --git a/Cura/util/sliceEngine.py b/Cura/util/sliceEngine.py index 03aaff9a..9ad792d4 100644 --- a/Cura/util/sliceEngine.py +++ b/Cura/util/sliceEngine.py @@ -18,6 +18,7 @@ import urllib2 import hashlib import socket import struct +import errno import cStringIO as StringIO from Cura.util import profile @@ -193,18 +194,22 @@ class Engine(object): break else: break - print 'Listening for engine communications on %d' % (self._serverPortNr) - self._serversocket.listen(1) thread = threading.Thread(target=self._socketListenThread) thread.daemon = True thread.start() def _socketListenThread(self): + self._serversocket.listen(1) + print 'Listening for engine communications on %d' % (self._serverPortNr) while True: - sock, _ = self._serversocket.accept() - thread = threading.Thread(target=self._socketConnectionThread, args=(sock,)) - thread.daemon = True - thread.start() + try: + sock, _ = self._serversocket.accept() + thread = threading.Thread(target=self._socketConnectionThread, args=(sock,)) + thread.daemon = True + thread.start() + except socket.error, e: + if e.errno != errno.EINTR: + raise def _socketConnectionThread(self, sock): layerNrOffset = 0