From 3f08901e844eda6c67b44e869c08ef9dc11265e4 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sun, 17 Aug 2025 04:20:09 +0800 Subject: Fix a few other goroutine leaks with contexts --- forged/internal/incoming/hooks/hooks.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'forged/internal/incoming/hooks/hooks.go') diff --git a/forged/internal/incoming/hooks/hooks.go b/forged/internal/incoming/hooks/hooks.go index c021406..3be0811 100644 --- a/forged/internal/incoming/hooks/hooks.go +++ b/forged/internal/incoming/hooks/hooks.go @@ -2,6 +2,7 @@ package hooks import ( "context" + "errors" "fmt" "net" @@ -59,7 +60,9 @@ func (server *Server) Run(ctx context.Context) error { for { conn, err := listener.Accept() if err != nil { - // TODO: Handle errors caused by context cancel + if errors.Is(err, net.ErrClosed) { + return nil + } return fmt.Errorf("accept conn: %w", err) } -- cgit v1.2.3