aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMaZderMind <github@mazdermind.de>2015-06-16 17:08:01 +0200
committerMaZderMind <github@mazdermind.de>2015-06-16 17:08:01 +0200
commit4a9e01714691df395064ac7d1045111ce5e3ddbd (patch)
treeabf18efc48191424ab8a300360f618d7dc7abb6c
parentc69b7397171e49221a42c0c49154d29722d38af0 (diff)
Close previous connection on 2nd Connect (for Video-Sources)
-rw-r--r--voctocore/lib/tcpsingleconnection.py7
1 files changed, 4 insertions, 3 deletions
diff --git a/voctocore/lib/tcpsingleconnection.py b/voctocore/lib/tcpsingleconnection.py
index 4ff94d2..886318f 100644
--- a/voctocore/lib/tcpsingleconnection.py
+++ b/voctocore/lib/tcpsingleconnection.py
@@ -1,5 +1,5 @@
#!/usr/bin/python3
-import logging, socket
+import logging, socket, time
from gi.repository import GObject
from lib.config import Config
@@ -28,8 +28,9 @@ class TCPSingleConnection(object):
self.log.info("Incomming Connection from %s", addr)
if self.currentConnection is not None:
- self.log.warn("Another Source is already connected")
- return True
+ self.log.warn("Another Source is already connected, closing existing pipeline")
+ self.disconnect()
+ time.sleep(1)
self.on_accepted(conn, addr)
self.currentConnection = conn