forked from quickfixgo/quickfix
-
Notifications
You must be signed in to change notification settings - Fork 0
/
logout_state.go
39 lines (30 loc) · 1.04 KB
/
logout_state.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package quickfix
import "github.com/quickfixgo/quickfix/enum"
type logoutState struct{}
func (state logoutState) String() string { return "Logout State" }
func (s logoutState) IsLoggedOn() bool { return false }
func (state logoutState) VerifyMsgIn(session *session, msg Message) MessageRejectError { return nil }
func (state logoutState) FixMsgIn(session *session, msg Message) (nextState sessionState) {
var msgType FIXString
if err := msg.Header.GetField(tagMsgType, &msgType); err != nil {
return latentState{}
}
switch string(msgType) {
case enum.MsgType_LOGOUT:
session.log.OnEvent("Received logout response")
return latentState{}
default:
return state
}
}
func (state logoutState) FixMsgInRej(session *session, msg Message, err MessageRejectError) sessionState {
return state.FixMsgIn(session, msg)
}
func (state logoutState) Timeout(session *session, event event) (nextState sessionState) {
switch event {
case logoutTimeout:
session.log.OnEvent("Timed out waiting for logout response")
return latentState{}
}
return state
}