-
-
Notifications
You must be signed in to change notification settings - Fork 907
[client, signal] Refactor/reduce signaling #4545
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
- send initial offer when open Peer connection - remove retry ticker - only controller send answer
There was a problem hiding this 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 refactors the signaling mechanism by adding a new delivery check method and simplifying the reconnection logic. The changes introduce a synchronous delivery check for signal messages and remove the complex exponential backoff mechanism in favor of a simpler timer-based approach.
Key changes:
- Adds a new
SendWithDeliveryCheck
RPC method that returns an error when the remote peer is not connected - Replaces complex exponential backoff reconnection logic with a fixed timer-based approach
- Updates client code to use the new delivery check method for offer/answer signaling
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 3 comments.
Show a summary per file
File | Description |
---|---|
shared/signal/proto/signalexchange.proto |
Adds new SendWithDeliveryCheck RPC method definition |
signal/server/signal.go |
Implements SendWithDeliveryCheck method with delivery validation |
shared/signal/proto/signalexchange_grpc.pb.go |
Generated gRPC client/server code for new method |
shared/signal/proto/signalexchange.pb.go |
Generated protobuf code with empty response type |
shared/signal/client/grpc.go |
Implements client-side SendWithDeliveryCheck method |
shared/signal/client/client.go |
Adds SendWithDeliveryCheck to Client interface |
client/internal/peer/signaler.go |
Updates signaling to use new delivery check method |
client/internal/peer/handshaker.go |
Minor logging reorder and code cleanup |
client/internal/peer/guard/guard.go |
Simplifies reconnection logic with fixed timer approach |
client/internal/peer/conn.go |
Adds initial offer sending on connection open |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
|
Describe your changes
When the client sends a signaling offer or answer, the Signal server may return an error if the message cannot be delivered. The client then checks the error type to decide how to proceed:
Whenever a peer reconnects to the signaling server and no active peer connection exists, it must send a new offer. This ensures that any signaling messages lost while the peer was offline are recovered and the connection can be re-established.
The NB_DISABLE_SEND_WITH_DELIVERY_CHECK: true|false option can be used to enforce that clients always use the server’s original methods.
For the review, keep in mind that these Signal server changes must support both old and new clients, and old clients must still connect properly with each other.
Issue ticket number and link
Stack
Checklist
Documentation
Select exactly one:
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/__