diff --git a/opengsq/protocols/source.py b/opengsq/protocols/source.py index f96370c..40650d4 100644 --- a/opengsq/protocols/source.py +++ b/opengsq/protocols/source.py @@ -101,24 +101,26 @@ def __parse_from_info_src(self, br: BinaryReader) -> SourceInfo: info["duration"] = br.read_byte() info["version"] = br.read_string() - edf = ExtraDataFlag(br.read_byte()) - info["edf"] = edf - if edf.has_flag(ExtraDataFlag.Port): - info["port"] = br.read_short() + if not br.is_end(): + edf = ExtraDataFlag(br.read_byte()) + info["edf"] = edf - if edf.has_flag(ExtraDataFlag.SteamID): - info["steam_id"] = br.read_long_long() + if edf.has_flag(ExtraDataFlag.Port): + info["port"] = br.read_short() - if edf.has_flag(ExtraDataFlag.Spectator): - info["spectator_port"] = br.read_short() - info["spectator_name"] = br.read_string() + if edf.has_flag(ExtraDataFlag.SteamID): + info["steam_id"] = br.read_long_long() - if edf.has_flag(ExtraDataFlag.Keywords): - info["keywords"] = br.read_string() + if edf.has_flag(ExtraDataFlag.Spectator): + info["spectator_port"] = br.read_short() + info["spectator_name"] = br.read_string() - if edf.has_flag(ExtraDataFlag.GameID): - info["game_id"] = br.read_long_long() + if edf.has_flag(ExtraDataFlag.Keywords): + info["keywords"] = br.read_string() + + if edf.has_flag(ExtraDataFlag.GameID): + info["game_id"] = br.read_long_long() return SourceInfo(**info) diff --git a/opengsq/responses/source/source_info.py b/opengsq/responses/source/source_info.py index ef57a25..3301987 100644 --- a/opengsq/responses/source/source_info.py +++ b/opengsq/responses/source/source_info.py @@ -16,7 +16,7 @@ class SourceInfo(PartialInfo): version: str """Version of the game installed on the server.""" - edf: ExtraDataFlag + edf: Optional[ExtraDataFlag] = None """If present, this specifies which additional data fields will be included.""" port: Optional[int] = None diff --git a/opengsq/version.py b/opengsq/version.py index 8a7ae5d..f3b2d6d 100644 --- a/opengsq/version.py +++ b/opengsq/version.py @@ -1 +1 @@ -__version__ = '3.0.8' +__version__ = '3.0.9'