[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:
Calum Lind 2018-06-27 14:34:24 +01:00
parent 1fa2de066f
commit 9bc2f62c80
1 changed files with 2 additions and 2 deletions

View File

@ -95,8 +95,8 @@ class DelugeTransferProtocol(Protocol, object):
# Read the first bytes of the message (MESSAGE_HEADER_SIZE bytes)
header = self._buffer[:MESSAGE_HEADER_SIZE]
payload_len = header[1:MESSAGE_HEADER_SIZE]
if header[0] != b'D':
raise Exception('Invalid header format. First byte is %d' % ord(header[0]))
if header[0:1] != b'D':
raise Exception('Invalid header format. First byte is %d' % ord(header[0:1]))
# Extract the length stored as a signed integer (using 4 bytes)
self._message_length = struct.unpack('!i', payload_len)[0]
if self._message_length < 0: