diff --git a/rcon/client.py b/rcon/client.py index 0c94797..02df231 100644 --- a/rcon/client.py +++ b/rcon/client.py @@ -9,7 +9,7 @@ __all__ = ['BaseClient'] class BaseClient: """A common RCON client.""" - _max_pkg_size: int | None = None + _max_packet_size: int | None = None def __init__( self, host: str, port: int, *, @@ -27,13 +27,13 @@ class BaseClient: cls, *, socket_type: SocketKind | None = None, - max_pkg_size: int | None = None + max_packet_size: int | None = None ): if socket_type is not None: cls._socket_type = socket_type - if max_pkg_size is not None: - cls._max_pkg_size = max_pkg_size + if max_packet_size is not None: + cls._max_packet_size = max_packet_size def __enter__(self): """Attempt an auto-login if a password is set.""" diff --git a/rcon/source/client.py b/rcon/source/client.py index 5260f1f..5ccb9d2 100644 --- a/rcon/source/client.py +++ b/rcon/source/client.py @@ -25,7 +25,10 @@ class Client(BaseClient, socket_type=SOCK_STREAM): with self._socket.makefile('rb') as file: packet = Packet.read(file) - if self._max_pkg_size and len(packet.payload) >= self._max_pkg_size: + if self._max_packet_size is None: + return packet + + if len(packet.payload) >= self._max_packet_size: return packet + self.read_followup_packet() return packet