Use dedicated ctx in stream

This commit is contained in:
Zoltán Papp
2025-11-18 17:25:46 +01:00
parent c57364596a
commit b03154dce5

View File

@@ -164,6 +164,9 @@ func (c *GrpcClient) handleJobStream(
serverPubKey wgtypes.Key,
msgHandler func(msg *proto.JobRequest) *proto.JobResponse,
) error {
ctx, cancelStream := context.WithCancel(ctx)
defer cancelStream()
stream, err := c.realClient.Job(ctx)
if err != nil {
log.WithContext(ctx).Errorf("failed to open job stream: %v", err)