Skip to content

Commit ec8d83a

Browse files
authored
[client] [UI] Down & Up NetBird Async When Settings Updated
[client] [UI] Down & Up NetBird Async When Settings Updated
1 parent 3130cce commit ec8d83a

File tree

1 file changed

+20
-19
lines changed

1 file changed

+20
-19
lines changed

client/ui/client_ui.go

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,7 @@ func (s *serviceClient) getSettingsForm() *widget.Form {
529529
var req proto.SetConfigRequest
530530
req.ProfileName = activeProf.Name
531531
req.Username = currUser.Username
532-
532+
533533
if iMngURL != "" {
534534
req.ManagementUrl = iMngURL
535535
}
@@ -563,27 +563,28 @@ func (s *serviceClient) getSettingsForm() *widget.Form {
563563
return
564564
}
565565

566-
status, err := conn.Status(s.ctx, &proto.StatusRequest{})
567-
if err != nil {
568-
log.Errorf("get service status: %v", err)
569-
dialog.ShowError(fmt.Errorf("Failed to get service status: %v", err), s.wSettings)
570-
return
571-
}
572-
if status.Status == string(internal.StatusConnected) {
573-
// run down & up
574-
_, err = conn.Down(s.ctx, &proto.DownRequest{})
575-
if err != nil {
576-
log.Errorf("down service: %v", err)
577-
}
578-
579-
_, err = conn.Up(s.ctx, &proto.UpRequest{})
566+
go func() {
567+
status, err := conn.Status(s.ctx, &proto.StatusRequest{})
580568
if err != nil {
581-
log.Errorf("up service: %v", err)
582-
dialog.ShowError(fmt.Errorf("Failed to reconnect: %v", err), s.wSettings)
569+
log.Errorf("get service status: %v", err)
570+
dialog.ShowError(fmt.Errorf("Failed to get service status: %v", err), s.wSettings)
583571
return
584572
}
585-
}
586-
573+
if status.Status == string(internal.StatusConnected) {
574+
// run down & up
575+
_, err = conn.Down(s.ctx, &proto.DownRequest{})
576+
if err != nil {
577+
log.Errorf("down service: %v", err)
578+
}
579+
580+
_, err = conn.Up(s.ctx, &proto.UpRequest{})
581+
if err != nil {
582+
log.Errorf("up service: %v", err)
583+
dialog.ShowError(fmt.Errorf("Failed to reconnect: %v", err), s.wSettings)
584+
return
585+
}
586+
}
587+
}()
587588
}
588589
},
589590
OnCancel: func() {

0 commit comments

Comments
 (0)