diff --git a/steam/client/__init__.py b/steam/client/__init__.py index f65d462..3518c4d 100644 --- a/steam/client/__init__.py +++ b/steam/client/__init__.py @@ -491,7 +491,7 @@ class SteamClient(CMClient, BuiltinBase): if login_id is None: obfuscationMask = 0xBAADF00D - local_address_int = ip_to_int(self.connection.socket.getsockname()[0]) + local_address_int = ip_to_int(self.connection.local_address) message.body.obfustucated_private_ip = local_address_int ^ obfuscationMask else: message.body.obfustucated_private_ip = login_id diff --git a/steam/core/connection.py b/steam/core/connection.py index ec53ab7..277bf36 100644 --- a/steam/core/connection.py +++ b/steam/core/connection.py @@ -28,6 +28,10 @@ class Connection(object): self.event_connected = event.Event() + @property + def local_address(self): + return self.socket.getsockname()[0] if self.event_connected.is_set() else None + def connect(self, server_addr): self._new_socket()