Commit e6ca0260 authored by Vincent Pelletier's avatar Vincent Pelletier

Split handler class into 2:

 - One to handle events expected as answers only, and to treat in their own thread.
 - One to handle all other events, and to tread them in dispatcher thread.
Update "expected answer" caller (app.py's _waitMessage).
Update test.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@318 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent f604e270
...@@ -31,7 +31,7 @@ from neo.protocol import Packet, INVALID_UUID, INVALID_TID, INVALID_PARTITION, \ ...@@ -31,7 +31,7 @@ from neo.protocol import Packet, INVALID_UUID, INVALID_TID, INVALID_PARTITION, \
STORAGE_NODE_TYPE, CLIENT_NODE_TYPE, \ STORAGE_NODE_TYPE, CLIENT_NODE_TYPE, \
RUNNING_STATE, TEMPORARILY_DOWN_STATE, \ RUNNING_STATE, TEMPORARILY_DOWN_STATE, \
UP_TO_DATE_STATE, FEEDING_STATE, INVALID_SERIAL UP_TO_DATE_STATE, FEEDING_STATE, INVALID_SERIAL
from neo.client.handler import ClientEventHandler from neo.client.handler import ClientEventHandler, ClientAnswerEventHandler
from neo.client.exception import NEOStorageError, NEOStorageConflictError, \ from neo.client.exception import NEOStorageError, NEOStorageConflictError, \
NEOStorageNotFoundError NEOStorageNotFoundError
from neo.util import makeChecksum, dump from neo.util import makeChecksum, dump
...@@ -198,6 +198,7 @@ class Application(object): ...@@ -198,6 +198,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.answer_handler = ClientAnswerEventHandler(self, dispatcher)
# Transaction specific variable # Transaction specific variable
self.tid = None self.tid = None
self.txn = None self.txn = None
...@@ -256,7 +257,7 @@ class Application(object): ...@@ -256,7 +257,7 @@ class Application(object):
else: else:
continue continue
conn.handler.dispatch(conn, packet) self.answer_handler.dispatch(conn, packet)
if target_conn is conn and msg_id == packet.getId() \ if target_conn is conn and msg_id == packet.getId() \
and packet.getType() & 0x8000: and packet.getType() & 0x8000:
......
This diff is collapsed.
This diff is collapsed.
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