Commit 6b79030c authored by Grégory Wisniewski's avatar Grégory Wisniewski

Raise UnexpectedPacketError when receiving an error message, this is more

consistent with other handler methods.
Remove the handleSerialNotFound method because it's never used.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@1139 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent 6fb4c73e
...@@ -373,11 +373,14 @@ class EventHandler(object): ...@@ -373,11 +373,14 @@ class EventHandler(object):
# Error packet handlers. # Error packet handlers.
# XXX: why answer a protocolError to another protocolError ? def handleNotReady(self, conn, packet, message):
handleNotReady = unexpectedPacket raise UnexpectedPacketError
handleOidNotFound = unexpectedPacket
handleSerialNotFound = unexpectedPacket def handleOidNotFound(self, conn, packet, message):
handleTidNotFound = unexpectedPacket raise UnexpectedPacketError
def handleTidNotFound(self, conn, packet, message):
raise UnexpectedPacketError
def handleProtocolError(self, conn, packet, message): def handleProtocolError(self, conn, packet, message):
# the connection should have been closed by the remote peer # the connection should have been closed by the remote peer
...@@ -394,7 +397,8 @@ class EventHandler(object): ...@@ -394,7 +397,8 @@ class EventHandler(object):
conn.close() conn.close()
def handleNoError(self, conn, packet, message): def handleNoError(self, conn, packet, message):
logging.debug("no error message : %s" %(message)) logging.debug("no error message : %s" % (message))
def initPacketDispatchTable(self): def initPacketDispatchTable(self):
d = {} d = {}
...@@ -470,7 +474,6 @@ class EventHandler(object): ...@@ -470,7 +474,6 @@ class EventHandler(object):
d[NO_ERROR_CODE] = self.handleNoError d[NO_ERROR_CODE] = self.handleNoError
d[NOT_READY_CODE] = self.handleNotReady d[NOT_READY_CODE] = self.handleNotReady
d[OID_NOT_FOUND_CODE] = self.handleOidNotFound d[OID_NOT_FOUND_CODE] = self.handleOidNotFound
d[SERIAL_NOT_FOUND_CODE] = self.handleSerialNotFound
d[TID_NOT_FOUND_CODE] = self.handleTidNotFound d[TID_NOT_FOUND_CODE] = self.handleTidNotFound
d[PROTOCOL_ERROR_CODE] = self.handleProtocolError d[PROTOCOL_ERROR_CODE] = self.handleProtocolError
d[TIMEOUT_ERROR_CODE] = self.handleTimeoutError d[TIMEOUT_ERROR_CODE] = self.handleTimeoutError
......
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