From 1cae98dfb33af9f733266b42cb3ee89048089880 Mon Sep 17 00:00:00 2001 From: Lev Babchenko Date: Tue, 5 Oct 2021 16:56:14 +0300 Subject: [PATCH] add cancellable context for registerForStats call --- srt/server.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/srt/server.go b/srt/server.go index b1da2a7..76cd24c 100644 --- a/srt/server.go +++ b/srt/server.go @@ -196,7 +196,9 @@ func (s *ServerImpl) Handle(ctx context.Context, sock *srtgo.SrtSocket, addr *ne streamid: &streamid, } - s.registerForStats(ctx, conn) + subctx, cancel := context.WithCancel(ctx) + defer cancel() + s.registerForStats(subctx, conn) switch streamid.Mode() { case stream.ModePlay: