Commit bba28c85 authored by Vincent Pelletier's avatar Vincent Pelletier

Fix a discrepancy in connectToPrimaryMasterNode calls: some were providing it...

Fix a discrepancy in connectToPrimaryMasterNode calls: some were providing it a Connector instance, others a Connection instance. It really expects a Connector instance, which is always available on self.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@346 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent c83cd1b3
......@@ -244,7 +244,7 @@ class Application(object):
break
self.uuid = uuid
# Connect to master node
self.connectToPrimaryMasterNode(self.connector_handler)
self.connectToPrimaryMasterNode()
def getQueue(self):
try:
......@@ -913,7 +913,7 @@ class Application(object):
def sync(self):
self._waitMessage()
def connectToPrimaryMasterNode(self, connector_handler):
def connectToPrimaryMasterNode(self):
"""Connect to a primary master node.
This can be called either at bootstrap or when
client got disconnected during process"""
......@@ -940,7 +940,7 @@ class Application(object):
else:
addr, port = self.primary_master_node.getServer()
# Request Node Identification
conn = MTClientConnection(self.em, self.handler, (addr, port), connector_handler=connector_handler)
conn = MTClientConnection(self.em, self.handler, (addr, port), connector_handler=self.connector_handler)
if self.nm.getNodeByServer((addr, port)) is None:
n = MasterNode(server = (addr, port))
self.nm.add(n)
......
......@@ -103,7 +103,7 @@ class ClientEventHandler(BaseClientEventHandler):
elif self.app.primary_master_node is not None and uuid == \
self.app.primary_master_node.getUUID():
logging.critical("connection to primary master node failed")
app.connectToPrimaryMasterNode(conn)
app.connectToPrimaryMasterNode()
else:
# Connection to a storage node failed
node = app.nm.getNodeByServer(conn.getAddress())
......@@ -124,7 +124,7 @@ class ClientEventHandler(BaseClientEventHandler):
app.master_conn.close()
app.master_conn = None
app.primary_master_node = None
app.connectToPrimaryMasterNode(conn)
app.connectToPrimaryMasterNode()
else:
node = app.nm.getNodeByServer(conn.getAddress())
if node.getNodeType() == STORAGE_NODE_TYPE:
......@@ -143,7 +143,7 @@ class ClientEventHandler(BaseClientEventHandler):
app.primary_master_node = -1
elif app.master_conn is not None and uuid == app.primary_master_node.getUUID():
logging.critical("connection timeout to primary master node expired")
app.connectToPrimaryMasterNode(conn)
app.connectToPrimaryMasterNode()
else:
node = app.nm.getNodeByServer(conn.getAddress())
if node.getNodeType() == STORAGE_NODE_TYPE:
......@@ -161,7 +161,7 @@ class ClientEventHandler(BaseClientEventHandler):
app.primary_master_node = -1
elif app.master_conn is not None and uuid == app.primary_master_node.getUUID():
logging.critical("primary master node is broken")
app.connectToPrimaryMasterNode(conn)
app.connectToPrimaryMasterNode()
else:
node = app.nm.getNodeByServer(conn.getAddress())
if node.getNodeType() == STORAGE_NODE_TYPE:
......
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