Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

set state to logon before return #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions session_state.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,16 @@ func (sm *stateMachine) Start(s *session) {
}

func (sm *stateMachine) Connect(session *session) {
sm.setState(session, logonState{})

// No special logon logic needed for FIX Acceptors.
if !session.InitiateLogon {
sm.setState(session, logonState{})
return
}

// Fire logon timeout event after the pre-configured delay period.
time.AfterFunc(session.LogonTimeout, func() { session.sessionEvent <- internal.LogonTimeout })

if session.RefreshOnLogon {
if err := session.store.Refresh(); err != nil {
session.logError(err)
Expand All @@ -39,10 +43,6 @@ func (sm *stateMachine) Connect(session *session) {
session.logError(err)
return
}

sm.setState(session, logonState{})
// Fire logon timeout event after the pre-configured delay period.
time.AfterFunc(session.LogonTimeout, func() { session.sessionEvent <- internal.LogonTimeout })
}

func (sm *stateMachine) Stop(session *session) {
Expand Down Expand Up @@ -193,8 +193,8 @@ func handleStateError(s *session, err error) sessionState {
return latentState{}
}

//sessionState is the current state of the session state machine. The session state determines how the session responds to
//incoming messages, timeouts, and requests to send application messages.
// sessionState is the current state of the session state machine. The session state determines how the session responds to
// incoming messages, timeouts, and requests to send application messages.
type sessionState interface {
//FixMsgIn is called by the session on incoming messages from the counter party. The return type is the next session state
//following message processing
Expand Down