From 7ab7381261245868b51ba7d22bdafea06f477d9a Mon Sep 17 00:00:00 2001 From: joo Date: Sat, 1 Oct 2016 15:52:17 +0100 Subject: [PATCH] Fix infinite loop in protocol negotiator. Add missing protocol versions for 1.10.1 and 1.10.2. --- minecraft/__init__.py | 2 ++ minecraft/networking/connection.py | 9 ++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/minecraft/__init__.py b/minecraft/__init__.py index 2fd0547..30cc398 100644 --- a/minecraft/__init__.py +++ b/minecraft/__init__.py @@ -21,6 +21,8 @@ SUPPORTED_MINECRAFT_VERSIONS = { '1.9.3': 110, '1.9.4': 110, '1.10': 210, + '1.10.1': 210, + '1.10.2': 210, '16w32a': 301, '16w32b': 302, '16w33a': 303, diff --git a/minecraft/networking/connection.py b/minecraft/networking/connection.py index 4e71c00..a99199b 100644 --- a/minecraft/networking/connection.py +++ b/minecraft/networking/connection.py @@ -90,7 +90,7 @@ class Connection(object): return proto_version if allowed_versions is None: - self.allowed_proto_versions = SUPPORTED_PROTOCOL_VERSIONS + self.allowed_proto_versions = set(SUPPORTED_PROTOCOL_VERSIONS) else: allowed_version = set(map(proto_version, allowed_versions)) self.allowed_proto_versions = allowed_version @@ -416,6 +416,10 @@ class LoginReactor(PacketReactor): r"|Outdated server! I'm still on) (?P.*)", data) if not match: return + + self.connection.allowed_proto_versions.remove( + self.connection.context.protocol_version) + version = match.group('version') if version in SUPPORTED_MINECRAFT_VERSIONS: new_version = SUPPORTED_MINECRAFT_VERSIONS[version] @@ -423,8 +427,7 @@ class LoginReactor(PacketReactor): new_version = max(SUPPORTED_PROTOCOL_VERSIONS) elif data.startswith('Outdated server!'): new_version = min(SUPPORTED_PROTOCOL_VERSIONS) - if new_version != self.connection.context.protocol_version \ - and new_version in self.connection.allowed_proto_versions: + if new_version in self.connection.allowed_proto_versions: # Ignore this disconnect packet and reconnect with the new # protocol version, making it appear (on the client side) as if # the client had initially connected with the (hopefully)