Commit 283c8d07 authored by Vincent Pelletier's avatar Vincent Pelletier

Make all connections share the same ClientEventHandler instance.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@325 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 9e4d305a
...@@ -67,13 +67,12 @@ class ConnectionPool(object): ...@@ -67,13 +67,12 @@ class ConnectionPool(object):
return None return None
app = self.app app = self.app
handler = ClientEventHandler(app, app.dispatcher)
# Loop until a connection is obtained. # Loop until a connection is obtained.
while 1: while 1:
logging.info('trying to connect to %s:%d', *addr) logging.info('trying to connect to %s:%d', *addr)
app.local_var.node_not_ready = 0 app.local_var.node_not_ready = 0
conn = MTClientConnection(app.em, handler, addr, conn = MTClientConnection(app.em, app.handler, addr,
connector_handler=self.app.connector_handler) connector_handler=self.app.connector_handler)
conn.lock() conn.lock()
try: try:
...@@ -204,6 +203,7 @@ class Application(object): ...@@ -204,6 +203,7 @@ class Application(object):
self.ptid = None self.ptid = None
self.num_replicas = 0 self.num_replicas = 0
self.num_partitions = 0 self.num_partitions = 0
self.handler = ClientEventHandler(self, self.dispatcher)
self.answer_handler = ClientAnswerEventHandler(self, self.dispatcher) self.answer_handler = ClientAnswerEventHandler(self, self.dispatcher)
# Transaction specific variable # Transaction specific variable
self.tid = None self.tid = None
...@@ -925,7 +925,6 @@ class Application(object): ...@@ -925,7 +925,6 @@ class Application(object):
conn = None conn = None
# Make application execute remaining message if any # Make application execute remaining message if any
self._waitMessage() self._waitMessage()
handler = ClientEventHandler(self, self.dispatcher)
while 1: while 1:
self.local_var.node_not_ready = 0 self.local_var.node_not_ready = 0
if self.primary_master_node is None: if self.primary_master_node is None:
...@@ -939,7 +938,7 @@ class Application(object): ...@@ -939,7 +938,7 @@ class Application(object):
else: else:
addr, port = self.primary_master_node.getServer() addr, port = self.primary_master_node.getServer()
# Request Node Identification # Request Node Identification
conn = MTClientConnection(self.em, handler, (addr, port), connector_handler=connector_handler) conn = MTClientConnection(self.em, self.handler, (addr, port), connector_handler=connector_handler)
if self.nm.getNodeByServer((addr, port)) is None: if self.nm.getNodeByServer((addr, port)) is None:
n = MasterNode(server = (addr, port)) n = MasterNode(server = (addr, port))
self.nm.add(n) self.nm.add(n)
......
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