Fix UP calls when state is idle (#338)

* Fix UP calls when state is idle

When we want to login we can call server.Login
It already checks the login status of the peer

* Remove unused status

* Defer close daemon client conn

Co-authored-by: braginini <bangvalo@gmail.com>
This commit is contained in:
Maycon Santos
2022-05-27 19:16:58 +02:00
committed by GitHub
parent 4088aaf6fe
commit 258cb3d43b
2 changed files with 51 additions and 52 deletions

View File

@@ -259,21 +259,13 @@ func (s *serviceClient) menuUpClick() error {
return err
}
status, err := conn.Status(s.ctx, &proto.StatusRequest{})
err = s.login()
if err != nil {
log.Errorf("get service status: %v", err)
return err
}
if status.Status == string(internal.StatusNeedsLogin) || status.Status == string(internal.StatusLoginFailed) {
err = s.login()
if err != nil {
log.Errorf("get service status: %v", err)
return err
}
}
status, err = conn.Status(s.ctx, &proto.StatusRequest{})
status, err := conn.Status(s.ctx, &proto.StatusRequest{})
if err != nil {
log.Errorf("get service status: %v", err)
return err