summaryrefslogtreecommitdiff
path: root/voctocore/lib
diff options
context:
space:
mode:
authorMaZderMind <github@mazdermind.de>2015-05-15 12:01:42 +0200
committerMaZderMind <github@mazdermind.de>2015-05-15 12:01:42 +0200
commit85371bff8cc5e70531c87b5708d3334412831a78 (patch)
tree0b9889567cd68f58e8f46e258b674b124a0ba888 /voctocore/lib
parent18af1394a8b732d94b48b8f13e78cfcae3e45a6e (diff)
Use existing addr object where available
Diffstat (limited to 'voctocore/lib')
-rw-r--r--voctocore/lib/avpreviewoutput.py2
-rw-r--r--voctocore/lib/avrawoutput.py2
-rw-r--r--voctocore/lib/tcpmulticonnection.py7
3 files changed, 7 insertions, 4 deletions
diff --git a/voctocore/lib/avpreviewoutput.py b/voctocore/lib/avpreviewoutput.py
index 3a40a00..b1bc27f 100644
--- a/voctocore/lib/avpreviewoutput.py
+++ b/voctocore/lib/avpreviewoutput.py
@@ -61,6 +61,6 @@ class AVPreviewOutput(TCPMultiConnection):
def on_disconnect(multifdsink, fileno):
if fileno == conn.fileno():
self.log.debug('fd %u removed from multifdsink', fileno)
- self.close_connection(conn)
+ self.close_connection(conn, addr)
fdsink.connect('client-fd-removed', on_disconnect)
diff --git a/voctocore/lib/avrawoutput.py b/voctocore/lib/avrawoutput.py
index 3c7d739..912c292 100644
--- a/voctocore/lib/avrawoutput.py
+++ b/voctocore/lib/avrawoutput.py
@@ -50,6 +50,6 @@ class AVRawOutput(TCPMultiConnection):
def on_disconnect(multifdsink, fileno):
if fileno == conn.fileno():
self.log.debug('fd %u removed from multifdsink', fileno)
- self.close_connection(conn)
+ self.close_connection(conn, addr)
fdsink.connect('client-fd-removed', on_disconnect)
diff --git a/voctocore/lib/tcpmulticonnection.py b/voctocore/lib/tcpmulticonnection.py
index 201ecde..5ad4ca2 100644
--- a/voctocore/lib/tcpmulticonnection.py
+++ b/voctocore/lib/tcpmulticonnection.py
@@ -36,7 +36,10 @@ class TCPMultiConnection(object):
return True
- def close_connection(self, conn):
+ def close_connection(self, conn, addr=None):
+ if addr is None:
+ addr = conn.getpeername()
+
self.currentConnections.remove(conn)
- self.log.info('Disconnected Receiver %s', conn.getpeername())
+ self.log.info('Disconnected Receiver %s', addr)
self.log.info('Now %u Receiver connected', len(self.currentConnections))