From da5f2f2423af63f02dd6eba94eccb0e982b3e804 Mon Sep 17 00:00:00 2001 From: l1b0k Date: Thu, 23 Jan 2025 20:01:12 +0800 Subject: [PATCH] fix: potential deadlock Signed-off-by: l1b0k --- pkg/eni/manager.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/pkg/eni/manager.go b/pkg/eni/manager.go index 1c941123..bbc81e8b 100644 --- a/pkg/eni/manager.go +++ b/pkg/eni/manager.go @@ -211,7 +211,11 @@ func (m *Manager) Allocate(ctx context.Context, cni *daemon.CNI, req *AllocReque cancel() break } - resultCh <- resp.NetworkConfigs + + select { + case <-ctx.Done(): + case resultCh <- resp.NetworkConfigs: + } } }() }