Skip to content

Commit

Permalink
Merge pull request #31 from freQniK/updates
Browse files Browse the repository at this point in the history
Return nil session if recent session status is of type StatusInactivePending
  • Loading branch information
freQniK authored Dec 6, 2023
2 parents ae74a70 + 8d76527 commit c4db21a
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion cmd/connect.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ func queryActiveSession(qsc sessiontypes.QueryServiceClient, address sdk.AccAddr
return nil, err
}
if len(result.Sessions) > 0 {
return &result.Sessions[0], nil
if result.Sessions[0].Status == hubtypes.StatusInactivePending {
return nil, nil
} else {
return &result.Sessions[0], nil
}
}

return nil, nil
Expand Down Expand Up @@ -212,6 +216,7 @@ func ConnectCmd() *cobra.Command {
return err
}

// Add a MsgEndRequest if session is active
if session != nil {
messages = append(
messages,
Expand Down Expand Up @@ -240,6 +245,7 @@ func ConnectCmd() *cobra.Command {
if err != nil {
return err
}

if session == nil {
return errors.New("no active session found")
}
Expand Down

0 comments on commit c4db21a

Please sign in to comment.