Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

python-valve is reporting an error when there is none #83

Open
andykais opened this issue Mar 10, 2020 · 0 comments
Open

python-valve is reporting an error when there is none #83

andykais opened this issue Mar 10, 2020 · 0 comments

Comments

@andykais
Copy link

  • Python-valve Version(s): python-valve==0.2.1
  • Python Version(s): 3.6.8
  • Operating System(s)/Platform(s): macos
  • Game Server(s) and Version(s): a2s (I cannot share more here)

Hi, when I run the following snippet,

def query_server(host, port):
  sqp_address = (host, port + 1)
  server = valve.source.a2s.ServerQuerier(sqp_address)
  info = server.info()
  rules = server.rules()

server.info() succeeds and returns proper data, but server.rules() throws the exception

Traceback (most recent call last):
  File "/Users/andrew/.virtualenvs/python-valve-a2s/lib/python3.6/site-packages/valve/source/messages.py", line 91, in validate
    raise ValueError
ValueError

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "query_server.py", line 28, in <module>
    info_dump = query_server(host, port)
  File "query_server.py", line 20, in query_server
    rules = server.rules()
  File "/Users/andrew/.virtualenvs/python-valve-a2s/lib/python3.6/site-packages/valve/source/a2s.py", line 226, in rules
    challenge = messages.GetChallengeResponse.decode(self.get_response())
  File "/Users/andrew/.virtualenvs/python-valve-a2s/lib/python3.6/site-packages/valve/source/messages.py", line 415, in decode
    values[field.name], buffer = field.decode(buffer, values)
  File "/Users/andrew/.virtualenvs/python-valve-a2s/lib/python3.6/site-packages/valve/source/messages.py", line 41, in needs_buffer
    return func(self, buffer, *args, **kwargs)
  File "/Users/andrew/.virtualenvs/python-valve-a2s/lib/python3.6/site-packages/valve/source/messages.py", line 131, in decode
    struct.unpack(self.format, field_data)[0]), left_overs)
  File "/Users/andrew/.virtualenvs/python-valve-a2s/lib/python3.6/site-packages/valve/source/messages.py", line 95, in validate
    value, self.name))
valve.source.messages.BrokenMessageError: Invalid value (69) for field 'response_type'

strangely, the same server responds fine using qstat and if I change the line on

ByteField("response_type", validators=[lambda x: x == 0x41]),

to be

        ByteField("response_type", validators=[lambda x: x == 0x41 or x == 69]),

then the rules field returns proper data. I don't know if this is a happy accident that I am getting proper data back, or if GetChallengeResponse should actually accept a wider range of inputs. Unfortunately I cannot share the server address, but hopefully this is enough to go off of

andykais added a commit to agoragames/python-valve that referenced this issue Mar 10, 2020
I havent dug into the purpose of response_types yet, but this package short circuits when a response type is given that it does not expect. We have an open issue with the package here serverstf#83. For now, this unblocks us with rocksteady
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant