[Py3] Fix tranfer header first byte check
The index of a byte in Python 3 will return an integer so use slice for compatibility with 2/3
This commit is contained in:
parent
1fa2de066f
commit
9bc2f62c80
|
@ -95,8 +95,8 @@ class DelugeTransferProtocol(Protocol, object):
|
||||||
# Read the first bytes of the message (MESSAGE_HEADER_SIZE bytes)
|
# Read the first bytes of the message (MESSAGE_HEADER_SIZE bytes)
|
||||||
header = self._buffer[:MESSAGE_HEADER_SIZE]
|
header = self._buffer[:MESSAGE_HEADER_SIZE]
|
||||||
payload_len = header[1:MESSAGE_HEADER_SIZE]
|
payload_len = header[1:MESSAGE_HEADER_SIZE]
|
||||||
if header[0] != b'D':
|
if header[0:1] != b'D':
|
||||||
raise Exception('Invalid header format. First byte is %d' % ord(header[0]))
|
raise Exception('Invalid header format. First byte is %d' % ord(header[0:1]))
|
||||||
# Extract the length stored as a signed integer (using 4 bytes)
|
# Extract the length stored as a signed integer (using 4 bytes)
|
||||||
self._message_length = struct.unpack('!i', payload_len)[0]
|
self._message_length = struct.unpack('!i', payload_len)[0]
|
||||||
if self._message_length < 0:
|
if self._message_length < 0:
|
||||||
|
|
Loading…
Reference in New Issue