From 18af1394a8b732d94b48b8f13e78cfcae3e45a6e Mon Sep 17 00:00:00 2001 From: MaZderMind Date: Fri, 15 May 2015 10:40:17 +0200 Subject: Move Class-Level variables to the Instances I should really learn python… MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- voctocore/lib/tcpsingleconnection.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'voctocore/lib/tcpsingleconnection.py') diff --git a/voctocore/lib/tcpsingleconnection.py b/voctocore/lib/tcpsingleconnection.py index d6a05ef..e604ce6 100644 --- a/voctocore/lib/tcpsingleconnection.py +++ b/voctocore/lib/tcpsingleconnection.py @@ -7,12 +7,10 @@ from lib.config import Config class TCPSingleConnection(object): log = logging.getLogger('TCPSingleConnection') - port = None - - boundSocket = None - currentConnection = None - def __init__(self, port): + if not hasattr(self, 'log'): + self.log = logging.getLogger('TCPMultiConnection') + self.port = port self.log.debug('Binding to Source-Socket on [::]:%u', port) @@ -22,6 +20,8 @@ class TCPSingleConnection(object): self.boundSocket.bind(('::', port)) self.boundSocket.listen(1) + self.currentConnection = None + self.log.debug('Setting GObject io-watch on Socket') GObject.io_add_watch(self.boundSocket, GObject.IO_IN, self.on_connect) -- cgit v1.2.3