summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaZderMind <git@mazdermind.de>2015-11-15 18:38:06 +0100
committerMaZderMind <git@mazdermind.de>2015-11-15 18:38:56 +0100
commit7061df44a9f2291c9a9147dea6878bbc1bd424d8 (patch)
treecb2b07776a57189d89c11a335faca0d099aa3f6f
parent16489a9153c5b95ace36adea11f261559e350ebd (diff)
Exit the Mainloop (and End the Program) when the Control-Connection dies, fixes #21
-rw-r--r--voctogui/lib/connection.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/voctogui/lib/connection.py b/voctogui/lib/connection.py
index 6bece3d..20197d0 100644
--- a/voctogui/lib/connection.py
+++ b/voctogui/lib/connection.py
@@ -4,7 +4,7 @@ import socket
import json
import sys
from queue import Queue
-from gi.repository import GObject
+from gi.repository import Gtk, GObject
log = logging.getLogger('Connection')
conn = None
@@ -60,10 +60,12 @@ def on_data(conn, _, leftovers, *args):
try:
leftovers.append(conn.recv(4096).decode(errors='replace'))
if len(leftovers[-1]) == 0:
- log.info("socket was closed")
+ log.info("Socket was closed")
# FIXME try to reconnect
- sys.exit(1)
+ conn.close()
+ Gtk.main_quit()
+ return False
except UnicodeDecodeError as e:
continue