镜像站点 · 本页由第三方 GitHub 只读镜像提供,非 GitHub 官方站点,不接受任何登录或凭据输入。前往 github.com
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 3 additions & 14 deletions api/stream_util.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ import (
// tryFindWorkingUrl attempts to validate a media link by checking if it can serve content.
// It tries the primary URL first, then falls back to mirrors if needed.
// Returns the first valid URL found or the main URL if nothing works.
//
// The returned URL carries no probe artifacts: callers hand it straight to a
// client, and a stray skip_play_count would stop the serving node from
// recording the listen.
func tryFindWorkingUrl(mediaLink *dbv1.MediaLink) *url.URL {
mainURL, err := url.Parse(mediaLink.Url)
if err != nil {
Expand All @@ -38,18 +34,11 @@ func tryFindWorkingUrl(mediaLink *dbv1.MediaLink) *url.URL {
Timeout: 5 * time.Second,
}
for _, u := range urls {
// Probe on a COPY. skip_play_count exists so this two-byte probe is not
// counted as a listen, but it belongs to the probe alone -- mutating u
// would carry the flag into the URL we hand the client, and the node
// serving /tracks/cidstream/:cid returns early from logTrackListen when
// it sees it. That silently suppressed the play for every caller of
// /v1/tracks/:id/stream.
probe := *u
q := probe.Query()
q := u.Query()
q.Set("skip_play_count", "true")
probe.RawQuery = q.Encode()
u.RawQuery = q.Encode()

req, err := http.NewRequest("GET", probe.String(), nil)
req, err := http.NewRequest("GET", u.String(), nil)
if err != nil {
continue
}
Expand Down
99 changes: 0 additions & 99 deletions api/stream_util_test.go

This file was deleted.