summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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