-
-
Notifications
You must be signed in to change notification settings - Fork 797
[client] Fix/nil relayed address #4153
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
Conversation
…ne status - handle the map in thread safe way - distinguish channel close and write operations
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 pull request fixes concurrency and nil pointer issues in the relay client code. The changes address a nil pointer panic that occurs when accessing the RelayAddr's String method and add proper synchronization to prevent race conditions in the peer subscription system.
- Adds mutex protection to prevent race conditions when accessing shared maps in PeersStateSubscription
- Refactors connection and handshake methods to properly handle RelayAddr lifecycle and prevent nil pointer access
- Improves channel handling to use buffered channels and proper signaling instead of relying on channel closure
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File | Description |
---|---|
relay/client/peer_subscription.go | Adds mutex synchronization, improves channel handling with buffered channels, and enhances error handling |
relay/client/client.go | Refactors connection methods to return RelayAddr and adds proper instanceURL lifecycle management |
|
Describe your changes
Fix nil pointer in Relay conn address
Meanwhile, we create a relayed net.Conn struct instance, it is possible to set the relayedURL to nil.
Issue ticket number and link
Stack
Checklist