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.
SENDSPIN_SERVER_URLis documented as the URL this run dialled, on an-srun only. It can be a URL that has nothing to do with the connection the stream arrived on.-sleaves 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.cppcannot 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.mdandsrc/hooks.hall point a hook that must be certain atSENDSPIN_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.