Skip to content

SENDSPIN_SERVER_URL can export a stale dialled URL for an inbound connection on an -s run #34

Description

@chrisuthe

SENDSPIN_SERVER_URL is documented as the URL this run dialled, on an -s run only. It can be a URL that has nothing to do with the connection the stream arrived on.

-s leaves the inbound listener up. OutboundConnection::dialed_url_ is set when a dial is attempted and never cleared, so once any dial has been attempted — succeeded and later dropped, or failed outright — a server that dials in afterwards produces a stream whose start hook exports the stale URL of that earlier attempt. src/main.cpp cannot tell the two apart: the library reports that a connection is up without saying where it came from.

The docs already hedge this (README, docs/wiki/Controlling-the-Player.md and src/hooks.h all point a hook that must be certain at SENDSPIN_SERVER_ID), but a variable documented as "the URL this run dialled" that sometimes describes a different connection is still wrong, and the hedge is a workaround rather than a fix.

Closing it properly needs sendspin-cpp to name the live connection's origin — there is no connect callback and nothing exposing a connection's URL or direction. Short of that, clearing dialed_url_ when the outbound attempt is no longer what holds the connection would at least turn a wrong answer into no answer, which is what the "left unset rather than exported empty" rule elsewhere in the hook environment already promises.

Raised by Copilot on #29 against src/main.cpp:912; the code is #28's, so it belongs here rather than on that PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions