diff --git a/session_state.go b/session_state.go index c8b1f42a4..fc701b9e1 100644 --- a/session_state.go +++ b/session_state.go @@ -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) @@ -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) { @@ -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