mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-26 04:06:38 +00:00
Use dedicated ctx in stream
This commit is contained in:
@@ -164,6 +164,9 @@ func (c *GrpcClient) handleJobStream(
|
|||||||
serverPubKey wgtypes.Key,
|
serverPubKey wgtypes.Key,
|
||||||
msgHandler func(msg *proto.JobRequest) *proto.JobResponse,
|
msgHandler func(msg *proto.JobRequest) *proto.JobResponse,
|
||||||
) error {
|
) error {
|
||||||
|
ctx, cancelStream := context.WithCancel(ctx)
|
||||||
|
defer cancelStream()
|
||||||
|
|
||||||
stream, err := c.realClient.Job(ctx)
|
stream, err := c.realClient.Job(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.WithContext(ctx).Errorf("failed to open job stream: %v", err)
|
log.WithContext(ctx).Errorf("failed to open job stream: %v", err)
|
||||||
|
|||||||
Reference in New Issue
Block a user