← 输入框|github.com|刷新
Skip to content

find_server_process reads the wrong port when RLBotServer has more than one argument #44

In review

Description

@gebrial

gateway.find_server_process takes the last command-line argument of a running RLBotServer as its socket port:

https://github.com/RLBot/python-interface/blob/8a0850f/rlbot/utils/gateway.py#L80

port = int(proc.cmdline()[-1])

That holds when the interface launches the server itself (RLBotServer <port>), but core accepts a second argument, the game port (RLBotServer [socketsPort] [gamePort], see RLBotCS/Main.cs). If the server was started by hand with both:

RLBotServer.exe 23234 23233

then find_server_process("RLBotServer.exe") returns port 23233, so MatchManager connects to the game port, not the socket port.

A non-numeric last argument also makes the int() call fail. The process is then skipped as if no server were running, and ensure_server_started raises FileNotFoundError. We ran into this while testing an extra server flag locally.

Suggested fix: read the socket port from the first argument after the executable (cmdline()[1]), which is where core parses it, and fall back to the default port if it isn't numeric.

Found with rlbot 2.0.0b56 on Windows.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions