From a16aed1db22739e7dea8098c79bc1963b871b5ec Mon Sep 17 00:00:00 2001 From: Taras Madan Date: Wed, 21 Jan 2026 20:00:38 +0100 Subject: all: fix context.Context usage --- pkg/flatrpc/conn.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'pkg/flatrpc') diff --git a/pkg/flatrpc/conn.go b/pkg/flatrpc/conn.go index 47b265493..e8ad1461f 100644 --- a/pkg/flatrpc/conn.go +++ b/pkg/flatrpc/conn.go @@ -45,11 +45,11 @@ func Listen(addr string) (*Serv, error) { // Serve accepts incoming connections and calls handler for each of them. // An error returned from the handler stops the server and aborts the whole processing. -func (s *Serv) Serve(baseCtx context.Context, handler func(context.Context, *Conn) error) error { - eg, ctx := errgroup.WithContext(baseCtx) +func (s *Serv) Serve(ctx context.Context, handler func(context.Context, *Conn) error) error { + eg, groupCtx := errgroup.WithContext(ctx) go func() { // If the context is cancelled, stop the server. - <-ctx.Done() + <-groupCtx.Done() s.Close() }() for { @@ -66,7 +66,7 @@ func (s *Serv) Serve(baseCtx context.Context, handler func(context.Context, *Con continue } eg.Go(func() error { - connCtx, cancel := context.WithCancel(ctx) + connCtx, cancel := context.WithCancel(groupCtx) defer cancel() c := NewConn(conn) -- cgit mrf-deployment