Skip to content

Commit

Permalink
go/runtime/host: Ensure each message handler has its own context
Browse files Browse the repository at this point in the history
  • Loading branch information
kostko committed Aug 15, 2024
1 parent 53f96d4 commit 263c307
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion go/runtime/host/protocol/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,12 @@ func (c *connection) workerIncoming() {
wg.Add(1)
go func() {
defer wg.Done()
c.handleMessage(ctx, &message)

// Ensure each message has its own context which is canceled at the end.
localCtx, localCancel := context.WithCancel(ctx)
defer localCancel()

c.handleMessage(localCtx, &message)
}()
}
}
Expand Down

0 comments on commit 263c307

Please sign in to comment.