Commit 50736599 authored by Grégory Wisniewski's avatar Grégory Wisniewski

Storage nodes bind on any available port by default.

git-svn-id: https://svn.erp5.org/repos/neo/trunk@2351 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 0ae725dd
......@@ -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))
......
......@@ -395,6 +395,9 @@ class ListeningConnection(BaseConnection):
except ConnectorTryAgainException:
pass
def getAddress(self):
return self.connector.getAddress()
def writable(self):
return False
......
......@@ -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
......
......@@ -43,7 +43,7 @@ parser.add_option('-d', '--database', help = 'database connections string')
defaults = dict(
name = 'storage',
bind = '127.0.0.1:20000',
bind = '127.0.0.1',
masters = '127.0.0.1:10000',
adapter = 'MySQL',
)
......
......@@ -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,
......
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment