mirror of
https://github.com/netbirdio/netbird.git
synced 2026-04-26 20:26:39 +00:00
[client] [UI] Down & Up NetBird Async When Settings Updated
[client] [UI] Down & Up NetBird Async When Settings Updated
This commit is contained in:
@@ -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() {
|
||||||
|
|||||||
Reference in New Issue
Block a user