summaryrefslogtreecommitdiff
path: root/voctocore/lib/tcpmulticonnection.py
diff options
context:
space:
mode:
authorMarkus Otto <otto@fs.tum.de>2015-08-22 19:15:22 +0200
committerMaZderMind <git@mazdermind.de>2015-08-31 20:02:04 +0200
commit46aace37db5c035a6d6b432db261dc7c417456f4 (patch)
treecc98a569c8c02491ce59cbf5b9a5613c96fd78b2 /voctocore/lib/tcpmulticonnection.py
parent5c243f1cac5cc489f3bbb821ab5064d9edf7d449 (diff)
make protocol work, some gui stuff
Diffstat (limited to 'voctocore/lib/tcpmulticonnection.py')
-rw-r--r--voctocore/lib/tcpmulticonnection.py9
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))