[Neo-report] r2351 gregory - in /trunk/neo: ./ scripts/ storage/ tests/

nobody at svn.erp5.org nobody at svn.erp5.org
Tue Oct 12 14:17:45 CEST 2010


Author: gregory
Date: Tue Oct 12 14:17:45 2010
New Revision: 2351

Log:
Storage nodes bind on any available port by default.

Modified:
    trunk/neo/config.py
    trunk/neo/connection.py
    trunk/neo/connector.py
    trunk/neo/scripts/neostorage.py
    trunk/neo/storage/app.py
    trunk/neo/tests/__init__.py

Modified: trunk/neo/config.py
==============================================================================
--- trunk/neo/config.py [iso-8859-1] (original)
+++ trunk/neo/config.py [iso-8859-1] Tue Oct 12 14:17:45 2010
@@ -59,9 +59,7 @@ class ConfigurationManager(object):
         if ':' in bind:
             (ip, port) = bind.split(':')
         else:
-            ip = bind
-            # took port from default bind address
-            port = self.defaults['bind'].split(':')[1]
+            (ip, port) = (bind, 0)
         ip = util.resolve(ip)
         return (ip, int(port))
 

Modified: trunk/neo/connection.py
==============================================================================
--- trunk/neo/connection.py [iso-8859-1] (original)
+++ trunk/neo/connection.py [iso-8859-1] Tue Oct 12 14:17:45 2010
@@ -395,6 +395,9 @@ class ListeningConnection(BaseConnection
         except ConnectorTryAgainException:
             pass
 
+    def getAddress(self):
+        return self.connector.getAddress()
+
     def writable(self):
         return False
 

Modified: trunk/neo/connector.py
==============================================================================
--- trunk/neo/connector.py [iso-8859-1] (original)
+++ trunk/neo/connector.py [iso-8859-1] Tue Oct 12 14:17:45 2010
@@ -89,6 +89,9 @@ class SocketConnector:
     def getError(self):
         return self.socket.getsockopt(socket.SOL_SOCKET, socket.SO_ERROR)
 
+    def getAddress(self):
+        return self.socket.getsockname()
+
     def getDescriptor(self):
         # this descriptor must only be used by the event manager, where it
         # guarantee unicity only while the connector is opened and registered

Modified: trunk/neo/scripts/neostorage.py
==============================================================================
--- trunk/neo/scripts/neostorage.py [iso-8859-1] (original)
+++ trunk/neo/scripts/neostorage.py [iso-8859-1] Tue Oct 12 14:17:45 2010
@@ -43,7 +43,7 @@ parser.add_option('-d', '--database', he
 
 defaults = dict(
     name = 'storage',
-    bind = '127.0.0.1:20000',
+    bind = '127.0.0.1',
     masters = '127.0.0.1:10000',
     adapter = 'MySQL',
 )

Modified: trunk/neo/storage/app.py
==============================================================================
--- trunk/neo/storage/app.py [iso-8859-1] (original)
+++ trunk/neo/storage/app.py [iso-8859-1] Tue Oct 12 14:17:45 2010
@@ -169,6 +169,7 @@ class Application(object):
         handler = identification.IdentificationHandler(self)
         self.listening_conn = ListeningConnection(self.em, handler,
             addr=self.server, connector=self.connector_handler())
+        self.server = self.listening_conn.getAddress()
 
         # Connect to a primary master node, verify data, and
         # start the operation. This cycle will be executed permanently,

Modified: trunk/neo/tests/__init__.py
==============================================================================
--- trunk/neo/tests/__init__.py [iso-8859-1] (original)
+++ trunk/neo/tests/__init__.py [iso-8859-1] Tue Oct 12 14:17:45 2010
@@ -406,6 +406,9 @@ class DoNothingConnector(Mock):
     def makeClientConnection(self, addr):
         self.addr = addr
 
+    def makeListeningConnection(self, addr):
+        self.addr = addr
+
     def getDescriptor(self):
         return self.desc
 





More information about the Neo-report mailing list