Commit de21fdf8 authored by Aurel's avatar Aurel

encode must raise ProtocolError if message is too big


git-svn-id: https://svn.erp5.org/repos/neo/branches/prototype3@384 71dcc9de-d417-0410-9af5-da40c76e7ee4
parent ef402ca1
...@@ -349,7 +349,7 @@ class Packet(object): ...@@ -349,7 +349,7 @@ class Packet(object):
msg = pack('!LHL', self._id, self._type, PACKET_HEADER_SIZE + len(self._body)) + self._body msg = pack('!LHL', self._id, self._type, PACKET_HEADER_SIZE + len(self._body)) + self._body
logging.debug('encoding %d:%x', self._id, self._type) logging.debug('encoding %d:%x', self._id, self._type)
if len(msg) > MAX_PACKET_SIZE: if len(msg) > MAX_PACKET_SIZE:
raise RuntimeError('message too big (%d)' % len(msg)) raise ProtocolError('message too big (%d)' % len(msg))
return msg return msg
__str__ = encode __str__ = encode
......
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