[client] [UI] Down & Up NetBird Async When Settings Updated

[client] [UI] Down & Up NetBird Async When Settings Updated
This commit is contained in:
hakansa
2025-09-18 18:13:29 +07:00
committed by GitHub
parent 3130cce72d
commit ec8d83ade4

View File

@@ -563,27 +563,28 @@ func (s *serviceClient) getSettingsForm() *widget.Form {
return return
} }
status, err := conn.Status(s.ctx, &proto.StatusRequest{}) go func() {
if err != nil { status, err := conn.Status(s.ctx, &proto.StatusRequest{})
log.Errorf("get service status: %v", err)
dialog.ShowError(fmt.Errorf("Failed to get service status: %v", err), s.wSettings)
return
}
if status.Status == string(internal.StatusConnected) {
// run down & up
_, err = conn.Down(s.ctx, &proto.DownRequest{})
if err != nil { if err != nil {
log.Errorf("down service: %v", err) log.Errorf("get service status: %v", err)
} dialog.ShowError(fmt.Errorf("Failed to get service status: %v", err), s.wSettings)
_, err = conn.Up(s.ctx, &proto.UpRequest{})
if err != nil {
log.Errorf("up service: %v", err)
dialog.ShowError(fmt.Errorf("Failed to reconnect: %v", err), s.wSettings)
return return
} }
} if status.Status == string(internal.StatusConnected) {
// run down & up
_, err = conn.Down(s.ctx, &proto.DownRequest{})
if err != nil {
log.Errorf("down service: %v", err)
}
_, err = conn.Up(s.ctx, &proto.UpRequest{})
if err != nil {
log.Errorf("up service: %v", err)
dialog.ShowError(fmt.Errorf("Failed to reconnect: %v", err), s.wSettings)
return
}
}
}()
} }
}, },
OnCancel: func() { OnCancel: func() {