chore(l4d2-web): clarify rcon req_id constants and helper docstring
Add comment noting _EXEC_REQ_ID/_MARKER_REQ_ID are arbitrary client-chosen values unrelated to SERVERDATA_* packet-type constants. Update _connect_and_auth docstring to accurately reflect that OSError/socket.timeout propagate raw from post-connect send/recv, while only connect failure is wrapped in RconError. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
085fd714a5
commit
9ef9ffdbde
1 changed files with 9 additions and 4 deletions
|
|
@ -32,7 +32,9 @@ SERVERDATA_EXECCOMMAND = 2
|
|||
SERVERDATA_AUTH_RESPONSE = 2
|
||||
SERVERDATA_RESPONSE_VALUE = 0
|
||||
|
||||
# req_id values used by execute_command
|
||||
# req_id values for execute_command's exec + marker packets.
|
||||
# These are arbitrary positive ints chosen by the client; the values
|
||||
# happen to be unrelated to the SERVERDATA_* packet-type constants.
|
||||
_EXEC_REQ_ID = 2
|
||||
_MARKER_REQ_ID = 0xC0DE
|
||||
|
||||
|
|
@ -68,10 +70,13 @@ class StatusResponse:
|
|||
def _connect_and_auth(
|
||||
sock: socket.socket, host: str, port: int, password: str
|
||||
) -> None:
|
||||
"""Open TCP connection and authenticate. Raises:
|
||||
"""Open TCP connection and authenticate.
|
||||
|
||||
* RconError – on connect failure or i/o error during handshake
|
||||
* RconAuthError – when the server returns req_id == -1 (bad password)
|
||||
Raises:
|
||||
RconError – on connect failure
|
||||
RconAuthError – when the server returns req_id == -1 (bad password)
|
||||
OSError / socket.timeout – raw, from the post-connect send/recv;
|
||||
callers wrap these into RconError.
|
||||
"""
|
||||
try:
|
||||
sock.connect((host, port))
|
||||
|
|
|
|||
Loading…
Reference in a new issue