[PR #3951] [MERGED] [client] Refactor context management in ConnMgr for clarity and consistency #24183

Closed
opened 2026-08-05 06:08:22 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/3951
Author: @pappz
Created: 6/10/2025
Status: Merged
Merged: 6/11/2025
Merged by: @pappz

Base: mainHead: fix/contexts-lazyconnection


📝 Commits (2)

  • ef60661 Refactor context management in ConnMgr for clarity and consistency
  • 11db855 Fix proper context handling

📊 Changes

3 files changed (+26 additions, -28 deletions)

View changed files

📝 client/internal/conn_mgr.go (+18 -20)
📝 client/internal/engine.go (+1 -1)
📝 client/internal/lazyconn/manager/manager.go (+7 -7)

📄 Description

In the conn_mgr we must distinguish two contexts. One is relevant for lazy-manager, and one (engine context) is relevant for peer creation. If we use the incorrect context, then when we disable the lazy connection feature, we cancel the peer connections too, instead of just the lazy manager.

Describe your changes

Stack

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/netbirdio/netbird/pull/3951 **Author:** [@pappz](https://github.com/pappz) **Created:** 6/10/2025 **Status:** ✅ Merged **Merged:** 6/11/2025 **Merged by:** [@pappz](https://github.com/pappz) **Base:** `main` ← **Head:** `fix/contexts-lazyconnection` --- ### 📝 Commits (2) - [`ef60661`](https://github.com/netbirdio/netbird/commit/ef60661735e28d3e2aee272ea550afca01b0cf65) Refactor context management in ConnMgr for clarity and consistency - [`11db855`](https://github.com/netbirdio/netbird/commit/11db855531bc05b35e78e14ef0c981c824c3985a) Fix proper context handling ### 📊 Changes **3 files changed** (+26 additions, -28 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/conn_mgr.go` (+18 -20) 📝 `client/internal/engine.go` (+1 -1) 📝 `client/internal/lazyconn/manager/manager.go` (+7 -7) </details> ### 📄 Description In the conn_mgr we must distinguish two contexts. One is relevant for lazy-manager, and one (engine context) is relevant for peer creation. If we use the incorrect context, then when we disable the lazy connection feature, we cancel the peer connections too, instead of just the lazy manager. ## Describe your changes ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [x] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 06:08:22 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#24183