Skip to content

Conversation

@lixmal
Copy link
Collaborator

@lixmal lixmal commented Oct 23, 2025

Describe your changes

Migrates the code to use grpc.NewClient, then connect and block manually. This leads to a small change in behavior; the dialer now gets the IP address passed instead of the hostname, leaving more control to grpc on which IP and family to pick for dialing.

Also fixes a minor issue on hook cleanup for failed dial attempts in the nbnet dialer.

Issue ticket number and link

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)

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

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Copilot AI review requested due to automatic review settings October 23, 2025 13:33
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR migrates the gRPC client code from the deprecated grpc.DialContext to grpc.NewClient, introducing manual connection management. The migration changes the connection establishment flow to explicitly connect and wait for readiness rather than blocking during dial. Additionally, the PR fixes a cleanup issue in the nbnet dialer where connection IDs weren't properly cleaned up on failed dial attempts.

Key changes:

  • Replaced grpc.DialContext with grpc.NewClient and added manual connection readiness checking
  • Fixed missing cleanup hook execution for failed dial attempts in the nbnet dialer
  • Corrected documentation comments to accurately reflect that hooks execute after (not before) closing connections

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.

Show a summary per file
File Description
client/grpc/dialer.go Migrated from grpc.DialContext to grpc.NewClient with manual connection readiness waiting
client/grpc/dialer_generic.go Removed unused parameters and redundant error logging in custom dialer
client/net/dialer_dial.go Added cleanup call for failed dial attempts and simplified error message
client/net/conn.go Refactored connection cleanup into separate function to support both successful and failed dial scenarios
client/net/listener_listen.go Fixed documentation comments to correctly state hooks execute after closing
client/net/dial.go Removed extraneous blank line

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@lixmal lixmal force-pushed the fix-deprecated-grpc branch from a9b9836 to fc15625 Compare October 23, 2025 13:35
@sonarqubecloud
Copy link

@lixmal lixmal merged commit 43c9a51 into main Oct 30, 2025
37 checks passed
@lixmal lixmal deleted the fix-deprecated-grpc branch October 30, 2025 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants