Skip to content

Commit

Permalink
Merge branch 'main' into cfg-fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ackleymi authored Jul 2, 2024
2 parents 91700d1 + 358abef commit a420261
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 4 deletions.
17 changes: 13 additions & 4 deletions in_session.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,14 +102,23 @@ func (state inSession) handleLogout(session *session, msg *Message) (nextState s
session.log.OnEvent("Received logout response")
}

if err := session.store.IncrNextTargetMsgSeqNum(); err != nil {
session.logError(err)
}

if session.ResetOnLogout {
if err := session.dropAndReset(); err != nil {
session.logError(err)
}
return latentState{}
}

if err := session.checkTargetTooLow(msg); err != nil {
return latentState{}
}

if err := session.checkTargetTooHigh(msg); err != nil {
return latentState{}
}

if err := session.store.IncrNextTargetMsgSeqNum(); err != nil {
session.logError(err)
}

return latentState{}
Expand Down
17 changes: 17 additions & 0 deletions in_session_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,23 @@ func (s *InSessionTestSuite) TestLogoutResetOnLogout() {
s.NoMessageQueued()
}

func (s *InSessionTestSuite) TestLogoutTargetTooHigh() {
s.MessageFactory.seqNum = 5

s.MockApp.On("FromAdmin").Return(nil)
s.MockApp.On("ToAdmin")
s.MockApp.On("OnLogout")
s.session.fixMsgIn(s.session, s.Logout())

s.MockApp.AssertExpectations(s.T())
s.State(latentState{})

s.LastToAdminMessageSent()
s.MessageType(string(msgTypeLogout), s.MockApp.lastToAdmin)
s.NextTargetMsgSeqNum(1)
s.NextSenderMsgSeqNum(2)
}

func (s *InSessionTestSuite) TestTimeoutNeedHeartbeat() {
s.MockApp.On("ToAdmin").Return(nil)
s.session.Timeout(s.session, internal.NeedHeartbeat)
Expand Down

0 comments on commit a420261

Please sign in to comment.