msmith - in flumotion/trunk: . flumotion/component/misc/porter flumotion/twisted

flumotion-commit at lists.fluendo.com flumotion-commit at lists.fluendo.com
Fri Jun 1 15:48:34 CEST 2007


Author: msmith
Date: Fri Jun  1 15:48:32 2007
New Revision: 5086

Modified:
   flumotion/trunk/ChangeLog
   flumotion/trunk/flumotion/component/misc/porter/porterclient.py
   flumotion/trunk/flumotion/twisted/fdserver.py
Log:
        * flumotion/component/misc/porter/porterclient.py:
        * flumotion/twisted/fdserver.py:
          When creating a new connection in a porter client, get the socket
          peer address immediately.
          Use this to respond to getPeer() later, more closely mirroring
          tcp.Server's behaviour.
          Fixes errors in httpfile client shutdown in some cases.



Modified: flumotion/trunk/ChangeLog
==============================================================================
--- flumotion/trunk/ChangeLog	(original)
+++ flumotion/trunk/ChangeLog	Fri Jun  1 15:48:32 2007
@@ -1,3 +1,13 @@
+2007-06-01  Michael Smith <msmith at fluendo.com>
+
+	* flumotion/component/misc/porter/porterclient.py:
+	* flumotion/twisted/fdserver.py:
+	  When creating a new connection in a porter client, get the socket
+	  peer address immediately.
+	  Use this to respond to getPeer() later, more closely mirroring
+	  tcp.Server's behaviour.
+	  Fixes errors in httpfile client shutdown in some cases.
+
 2007-06-01  Zaheer Abbas Merali  <zaheerabbas at merali dot org>
 
 	* flumotion/component/bouncers/icalbouncer.py (IcalBouncer.do_setup,

Modified: flumotion/trunk/flumotion/component/misc/porter/porterclient.py
==============================================================================
--- flumotion/trunk/flumotion/component/misc/porter/porterclient.py	(original)
+++ flumotion/trunk/flumotion/component/misc/porter/porterclient.py	Fri Jun  1 15:48:32 2007
@@ -37,8 +37,9 @@
     Similar to tcp.Server, but gets the initial FD from a different source,
     obviously, and also passes along some data with the original connection.
     """
-    def __init__(self, sock, protocol, additionalData):
+    def __init__(self, sock, protocol, addr, additionalData):
         Connection.__init__(self, sock, protocol)
+        self.client = addr
         
         # Inform the protocol we've made a connection.
         protocol.makeConnection(self)
@@ -60,7 +61,7 @@
         return address.IPv4Address('TCP', *(self.socket.getsockname() + ('INET',)))
 
     def getPeer(self):
-        return address.IPv4Address('TCP', *(self.socket.getpeername() + ('INET',)))
+        return address.IPv4Address('TCP', *(self.client + ('INET',)))
 
 class PorterMedium(medium.BaseMedium):
     """

Modified: flumotion/trunk/flumotion/twisted/fdserver.py
==============================================================================
--- flumotion/trunk/flumotion/twisted/fdserver.py	(original)
+++ flumotion/trunk/flumotion/twisted/fdserver.py	Fri Jun  1 15:48:32 2007
@@ -142,11 +142,11 @@
             peeraddr = sock.getpeername()
            
             # Based on bits in tcp.Port.doRead()
-            protocol = self.childFactory.buildProtocol(
-                address._ServerFactoryIPv4Address('TCP', 
-                     peeraddr[0], peeraddr[1]))
+            addr = address._ServerFactoryIPv4Address('TCP', 
+                peeraddr[0], peeraddr[1])
+            protocol = self.childFactory.buildProtocol(addr)
 
-            self._connectionClass(sock, protocol, message)
+            self._connectionClass(sock, protocol, peeraddr, message)
         else:
             self.warning("Unexpected: FD-passing message with len(fds) != 1")
 


More information about the flumotion-commit mailing list