Commit 6284c5ee authored by Grégory Wisniewski's avatar Grégory Wisniewski

Raise ProtocolError when unknown packet type found.


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@441 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent dd65c6cb
......@@ -332,7 +332,11 @@ class Packet(object):
if len(msg) < MIN_PACKET_SIZE:
return None
msg_id, msg_type, msg_len = unpack('!LHL', msg[:PACKET_HEADER_SIZE])
try:
msg_type = packet_types[msg_type]
except KeyError:
raise ProtocolError(cls(msg_id, msg_type),
'Unknown packet type')
if msg_len > MAX_PACKET_SIZE:
raise ProtocolError(cls(msg_id, msg_type),
'message too big (%d)' % msg_len)
......
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