Fix streams decoding in BMProto.bm_command_version()

This commit is contained in:
Dmitri Bogomolov 2020-05-21 01:17:12 +03:00
parent 2a62fb79cc
commit d15e614bb1
Signed by untrusted user: g1itch
GPG Key ID: 720A756F18DEED13

View File

@ -512,9 +512,11 @@ class BMProto(AdvancedDispatcher, ObjectTracker):
Incoming version.
Parse and log, remember important things, like streams, bitfields, etc.
"""
decoded = self.decode_payload_content("IQQiiQlslv")
(self.remoteProtocolVersion, self.services, self.timestamp,
self.sockNode, self.peerNode, self.nonce, self.userAgent,
self.streams) = self.decode_payload_content("IQQiiQlsLv")
self.sockNode, self.peerNode, self.nonce, self.userAgent
) = decoded[:7]
self.streams = decoded[7:]
self.nonce = struct.pack('>Q', self.nonce)
self.timeOffset = self.timestamp - int(time.time())
logger.debug('remoteProtocolVersion: %i', self.remoteProtocolVersion)