diff options
author | Markus Otto <otto@fs.tum.de> | 2015-08-22 19:15:22 +0200 |
---|---|---|
committer | MaZderMind <git@mazdermind.de> | 2015-08-31 20:02:04 +0200 |
commit | 46aace37db5c035a6d6b432db261dc7c417456f4 (patch) | |
tree | cc98a569c8c02491ce59cbf5b9a5613c96fd78b2 /voctocore/lib/tcpmulticonnection.py | |
parent | 5c243f1cac5cc489f3bbb821ab5064d9edf7d449 (diff) |
make protocol work, some gui stuff
Diffstat (limited to 'voctocore/lib/tcpmulticonnection.py')
-rw-r--r-- | voctocore/lib/tcpmulticonnection.py | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/voctocore/lib/tcpmulticonnection.py b/voctocore/lib/tcpmulticonnection.py index 927ac06..e6f8b5b 100644 --- a/voctocore/lib/tcpmulticonnection.py +++ b/voctocore/lib/tcpmulticonnection.py @@ -1,5 +1,6 @@ #!/usr/bin/python3 import logging, socket +from queue import Queue from gi.repository import GObject from lib.config import Config @@ -10,7 +11,7 @@ class TCPMultiConnection(object): self.log = logging.getLogger('TCPMultiConnection') self.boundSocket = None - self.currentConnections = [] + self.currentConnections = dict() self.log.debug('Binding to Source-Socket on [::]:%u', port) self.boundSocket = socket.socket(socket.AF_INET6) @@ -24,9 +25,11 @@ class TCPMultiConnection(object): def on_connect(self, sock, *args): conn, addr = sock.accept() + conn.setblocking(False) + self.log.info("Incomming Connection from %s", addr) - self.currentConnections.append(conn) + self.currentConnections[conn] = Queue() self.log.info('Now %u Receiver connected', len(self.currentConnections)) self.on_accepted(conn, addr) @@ -34,5 +37,5 @@ class TCPMultiConnection(object): return True def close_connection(self, conn): - self.currentConnections.remove(conn) + del(self.currentConnections[conn]) self.log.info('Now %u Receiver connected', len(self.currentConnections)) |