From 4a9e01714691df395064ac7d1045111ce5e3ddbd Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Tue, 16 Jun 2015 17:08:01 +0200 Subject: Close previous connection on 2nd Connect (for Video-Sources) --- voctocore/lib/tcpsingleconnection.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'voctocore') 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 -- cgit v1.2.3