diff --git a/shared/signal/client/grpc.go b/shared/signal/client/grpc.go index ae40caa3b..82ab678f4 100644 --- a/shared/signal/client/grpc.go +++ b/shared/signal/client/grpc.go @@ -160,7 +160,7 @@ func (c *GrpcClient) Receive(ctx context.Context, msgHandler func(msg *proto.Mes c.notifyConnected() // Start worker pool if not already started - c.startEncryptionWorker(ctx, msgHandler) + c.startEncryptionWorker(msgHandler) // start receiving messages from the Signal stream (from other peers through signal) err = c.receive(stream) @@ -427,15 +427,16 @@ func (c *GrpcClient) receive(stream proto.SignalExchange_ConnectStreamClient) er } } -func (c *GrpcClient) startEncryptionWorker(ctx context.Context, handler func(msg *proto.Message) error) { +func (c *GrpcClient) startEncryptionWorker(handler func(msg *proto.Message) error) { if c.decryptionWorker != nil { return } c.decryptionWorker = NewWorker(c.decryptMessage, handler) - c.decryptionWg.Add(1) - workerCtx, workerCancel := context.WithCancel(ctx) + workerCtx, workerCancel := context.WithCancel(context.Background()) c.decryptionWorkerCancel = workerCancel + + c.decryptionWg.Add(1) go func() { defer workerCancel() c.decryptionWorker.Work(workerCtx) diff --git a/shared/signal/client/worker.go b/shared/signal/client/worker.go index 1248a0403..c724319b7 100644 --- a/shared/signal/client/worker.go +++ b/shared/signal/client/worker.go @@ -48,7 +48,7 @@ func (w *Worker) Work(ctx context.Context) { } case <-ctx.Done(): - log.Debugf("Message worker stopping due to context cancellation") + log.Infof("Message worker stopping due to context cancellation") return } }