-
-
Notifications
You must be signed in to change notification settings - Fork 910
Modify client-side behavior #4563
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
e891783 to
f42e189
Compare
f42e189 to
b070304
Compare
392d25e to
e04b989
Compare
| import ( | ||
| "context" | ||
| "fmt" | ||
| "github.com/netbirdio/netbird/client/internal/statemanager" |
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.
Please keep the order of the imported packages as usual
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.
And everywhere else.
client/internal/connect.go
Outdated
| c.engineMutex.Lock() | ||
| c.engine = NewEngine(engineCtx, cancel, signalClient, mgmClient, relayManager, engineConfig, mobileDependency, c.statusRecorder, checks) | ||
| if loginResp.PeerConfig != nil && loginResp.PeerConfig.AutoUpdate != nil { | ||
| if c.engine.updateManager == nil && loginResp.PeerConfig.AutoUpdate.Version != "disabled" { |
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.
Where does this string come from? It should be const
client/internal/connect.go
Outdated
| c.engineMutex.Lock() | ||
| c.engine = NewEngine(engineCtx, cancel, signalClient, mgmClient, relayManager, engineConfig, mobileDependency, c.statusRecorder, checks) | ||
| if loginResp.PeerConfig != nil && loginResp.PeerConfig.AutoUpdate != nil { | ||
| if c.engine.updateManager == nil && loginResp.PeerConfig.AutoUpdate.Version != "disabled" { |
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.
Code duplication with the engine. Move this logic into a function
|
Please fix the build issues |
| return u | ||
| } | ||
|
|
||
| func (u *UpdateManager) StartWithTimeout(ctx context.Context, timeout time.Duration) { |
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.
What will happen to the fetcher after a timeout? It seems like it will never be freed
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.
Since timeout will cancel the context, onContextCancel will handle fetcher cleanup
| u.wg.Wait() | ||
| } | ||
|
|
||
| func (u *UpdateManager) onContextCancel() { |
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.
You clean up updateManager with Stop and also with context cancellation. This means we have a race condition in the onContextCancel and Stop() functions.
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.
Added the locking mechanism from the original PR modifications
|



Describe your changes
AlwaysUpdateto AutoUpdate struct, when true, the client will update as soon as possible regardless of time of connection, when false, the client will only update within the first minute of Engine startupUpdating...screen, no actual progress is shown, just that it's updating.Manual testing done
netbird-ui.exe --update.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/__