From 4562ff293b8036edb69f7e50900811d4e307b476 Mon Sep 17 00:00:00 2001 From: Son Roy Almerol Date: Sat, 14 Dec 2024 18:48:44 -0500 Subject: [PATCH] close statusChan on ProxyStream instead --- handlers/stream_handler.go | 1 - proxy/proxy_stream.go | 2 ++ 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/handlers/stream_handler.go b/handlers/stream_handler.go index 6e2adb6..ce3b6ca 100644 --- a/handlers/stream_handler.go +++ b/handlers/stream_handler.go @@ -73,7 +73,6 @@ func StreamHandler(w http.ResponseWriter, r *http.Request, cm *store.Concurrency } exitStatus := make(chan int) - defer close(exitStatus) utils.SafeLogf("Proxying %s to %s\n", r.RemoteAddr, selectedUrl) go stream.ProxyStream(ctx, selectedIndex, resp, r, w, exitStatus) diff --git a/proxy/proxy_stream.go b/proxy/proxy_stream.go index b8a18e6..e6c4dce 100644 --- a/proxy/proxy_stream.go +++ b/proxy/proxy_stream.go @@ -14,6 +14,8 @@ import ( ) func (instance *StreamInstance) ProxyStream(ctx context.Context, m3uIndex int, resp *http.Response, r *http.Request, w http.ResponseWriter, statusChan chan int) { + defer close(statusChan) + bufferMbInt, err := strconv.Atoi(os.Getenv("BUFFER_MB")) if err != nil || bufferMbInt < 0 { bufferMbInt = 0