From da1ca82c4e72334fac77fb33e2c6c9c0876d136f Mon Sep 17 00:00:00 2001 From: Chris Busbey Date: Mon, 3 Oct 2016 15:35:22 -0500 Subject: [PATCH] message pool for inbound messages --- in_session.go | 56 +++++++++++++++++++++++--------------------- in_session_test.go | 6 ++--- latent_state.go | 2 +- logon_state.go | 6 ++--- logout_state.go | 2 +- logout_state_test.go | 2 +- message.go | 3 +++ message_pool.go | 26 ++++++++++++++++++++ not_session_time.go | 2 +- quickfix_test.go | 16 ++++++------- resend_state.go | 8 +++++-- session.go | 2 ++ session_state.go | 12 ++++++---- session_test.go | 44 +++++++++++++++++----------------- 14 files changed, 114 insertions(+), 73 deletions(-) create mode 100644 message_pool.go diff --git a/in_session.go b/in_session.go index 846168a46..3f6356dd2 100644 --- a/in_session.go +++ b/in_session.go @@ -11,7 +11,7 @@ type inSession struct{ loggedOn } func (state inSession) String() string { return "In Session" } -func (state inSession) FixMsgIn(session *session, msg Message) sessionState { +func (state inSession) FixMsgIn(session *session, msg *Message) sessionState { msgType, err := msg.Header.GetBytes(tagMsgType) if err != nil { return handleStateError(session, err) @@ -19,8 +19,8 @@ func (state inSession) FixMsgIn(session *session, msg Message) sessionState { switch enum.MsgType(msgType) { case enum.MsgType_LOGON: - if err := session.handleLogon(msg); err != nil { - if err := session.initiateLogoutInReplyTo("", &msg); err != nil { + if err := session.handleLogon(*msg); err != nil { + if err := session.initiateLogoutInReplyTo("", msg); err != nil { return handleStateError(session, err) } return logoutState{} @@ -36,7 +36,7 @@ func (state inSession) FixMsgIn(session *session, msg Message) sessionState { case enum.MsgType_TEST_REQUEST: return state.handleTestRequest(session, msg) default: - if err := session.verify(msg); err != nil { + if err := session.verify(*msg); err != nil { return state.processReject(session, msg, err) } } @@ -71,8 +71,8 @@ func (state inSession) Timeout(session *session, event internal.Event) (nextStat return state } -func (state inSession) handleLogout(session *session, msg Message) (nextState sessionState) { - if err := session.verifySelect(msg, false, false); err != nil { +func (state inSession) handleLogout(session *session, msg *Message) (nextState sessionState) { + if err := session.verifySelect(*msg, false, false); err != nil { return state.processReject(session, msg, err) } @@ -80,7 +80,7 @@ func (state inSession) handleLogout(session *session, msg Message) (nextState se session.log.OnEvent("Received logout request") session.log.OnEvent("Sending logout response") - if err := session.sendLogoutInReplyTo("", &msg); err != nil { + if err := session.sendLogoutInReplyTo("", msg); err != nil { session.logError(err) } } else { @@ -100,8 +100,8 @@ func (state inSession) handleLogout(session *session, msg Message) (nextState se return latentState{} } -func (state inSession) handleTestRequest(session *session, msg Message) (nextState sessionState) { - if err := session.verify(msg); err != nil { +func (state inSession) handleTestRequest(session *session, msg *Message) (nextState sessionState) { + if err := session.verify(*msg); err != nil { return state.processReject(session, msg, err) } var testReq FIXString @@ -111,7 +111,7 @@ func (state inSession) handleTestRequest(session *session, msg Message) (nextSta heartBt := NewMessage() heartBt.Header.SetField(tagMsgType, FIXString("0")) heartBt.Body.SetField(tagTestReqID, testReq) - if err := session.sendInReplyTo(heartBt, &msg); err != nil { + if err := session.sendInReplyTo(heartBt, msg); err != nil { return handleStateError(session, err) } } @@ -122,7 +122,7 @@ func (state inSession) handleTestRequest(session *session, msg Message) (nextSta return state } -func (state inSession) handleSequenceReset(session *session, msg Message) (nextState sessionState) { +func (state inSession) handleSequenceReset(session *session, msg *Message) (nextState sessionState) { var gapFillFlag FIXBoolean if msg.Body.Has(tagGapFillFlag) { if err := msg.Body.GetField(tagGapFillFlag, &gapFillFlag); err != nil { @@ -130,7 +130,7 @@ func (state inSession) handleSequenceReset(session *session, msg Message) (nextS } } - if err := session.verifySelect(msg, bool(gapFillFlag), bool(gapFillFlag)); err != nil { + if err := session.verifySelect(*msg, bool(gapFillFlag), bool(gapFillFlag)); err != nil { return state.processReject(session, msg, err) } @@ -146,7 +146,7 @@ func (state inSession) handleSequenceReset(session *session, msg Message) (nextS } case newSeqNo < expectedSeqNum: //FIXME: to be compliant with legacy tests, do not include tag in reftagid? (11c_NewSeqNoLess) - if err := session.doReject(msg, valueIsIncorrectNoTag()); err != nil { + if err := session.doReject(*msg, valueIsIncorrectNoTag()); err != nil { return handleStateError(session, err) } } @@ -154,8 +154,8 @@ func (state inSession) handleSequenceReset(session *session, msg Message) (nextS return state } -func (state inSession) handleResendRequest(session *session, msg Message) (nextState sessionState) { - if err := session.verifyIgnoreSeqNumTooHighOrLow(msg); err != nil { +func (state inSession) handleResendRequest(session *session, msg *Message) (nextState sessionState) { + if err := session.verifyIgnoreSeqNumTooHighOrLow(*msg); err != nil { return state.processReject(session, msg, err) } @@ -183,15 +183,15 @@ func (state inSession) handleResendRequest(session *session, msg Message) (nextS endSeqNo = expectedSeqNum - 1 } - if err := state.resendMessages(session, int(beginSeqNo), endSeqNo, msg); err != nil { + if err := state.resendMessages(session, int(beginSeqNo), endSeqNo, *msg); err != nil { return handleStateError(session, err) } - if err := session.checkTargetTooLow(msg); err != nil { + if err := session.checkTargetTooLow(*msg); err != nil { return state } - if err := session.checkTargetTooHigh(msg); err != nil { + if err := session.checkTargetTooHigh(*msg); err != nil { return state } @@ -249,7 +249,7 @@ func (state inSession) resendMessages(session *session, beginSeqNo, endSeqNo int return } -func (state inSession) processReject(session *session, msg Message, rej MessageRejectError) sessionState { +func (state inSession) processReject(session *session, msg *Message, rej MessageRejectError) sessionState { switch TypedError := rej.(type) { case targetTooHigh: @@ -266,10 +266,12 @@ func (state inSession) processReject(session *session, msg Message, rej MessageR } if nextState.messageStash == nil { - nextState.messageStash = make(map[int]Message) + nextState.messageStash = make(map[int]*Message) } nextState.messageStash[TypedError.ReceivedTarget] = msg + //do not reclaim stashed message + msg.keepMessage = true return nextState @@ -284,7 +286,7 @@ func (state inSession) processReject(session *session, msg Message, rej MessageR switch rej.RejectReason() { case rejectReasonCompIDProblem, rejectReasonSendingTimeAccuracyProblem: - if err := session.doReject(msg, rej); err != nil { + if err := session.doReject(*msg, rej); err != nil { return handleStateError(session, err) } @@ -293,7 +295,7 @@ func (state inSession) processReject(session *session, msg Message, rej MessageR } return logoutState{} default: - if err := session.doReject(msg, rej); err != nil { + if err := session.doReject(*msg, rej); err != nil { return handleStateError(session, err) } @@ -304,11 +306,11 @@ func (state inSession) processReject(session *session, msg Message, rej MessageR } } -func (state inSession) doTargetTooLow(session *session, msg Message, rej targetTooLow) (nextState sessionState) { +func (state inSession) doTargetTooLow(session *session, msg *Message, rej targetTooLow) (nextState sessionState) { var posDupFlag FIXBoolean if msg.Header.Has(tagPossDupFlag) { if err := msg.Header.GetField(tagPossDupFlag, &posDupFlag); err != nil { - if rejErr := session.doReject(msg, err); rejErr != nil { + if rejErr := session.doReject(*msg, err); rejErr != nil { return handleStateError(session, rejErr) } return state @@ -323,7 +325,7 @@ func (state inSession) doTargetTooLow(session *session, msg Message, rej targetT } if !msg.Header.Has(tagOrigSendingTime) { - if err := session.doReject(msg, RequiredTagMissing(tagOrigSendingTime)); err != nil { + if err := session.doReject(*msg, RequiredTagMissing(tagOrigSendingTime)); err != nil { return handleStateError(session, err) } return state @@ -331,7 +333,7 @@ func (state inSession) doTargetTooLow(session *session, msg Message, rej targetT var origSendingTime FIXUTCTimestamp if err := msg.Header.GetField(tagOrigSendingTime, &origSendingTime); err != nil { - if rejErr := session.doReject(msg, err); rejErr != nil { + if rejErr := session.doReject(*msg, err); rejErr != nil { return handleStateError(session, rejErr) } return state @@ -343,7 +345,7 @@ func (state inSession) doTargetTooLow(session *session, msg Message, rej targetT } if sendingTime.Before(origSendingTime.Time) { - if err := session.doReject(msg, sendingTimeAccuracyProblem()); err != nil { + if err := session.doReject(*msg, sendingTimeAccuracyProblem()); err != nil { return handleStateError(session, err) } diff --git a/in_session_test.go b/in_session_test.go index 938f69706..57a95d6b6 100644 --- a/in_session_test.go +++ b/in_session_test.go @@ -62,7 +62,7 @@ func (s *InSessionTestSuite) TestLogoutResetOnLogout() { s.session.ResetOnLogout = true s.MockApp.On("ToApp").Return(nil) - s.Nil(s.queueForSend(s.NewOrderSingle())) + s.Nil(s.queueForSend(*s.NewOrderSingle())) s.MockApp.AssertExpectations(s.T()) s.MockApp.On("FromAdmin").Return(nil) @@ -243,7 +243,7 @@ func (s *InSessionTestSuite) TestFIXMsgInResendRequestAllAdminThenApp() { s.LastToAdminMessageSent() s.MockApp.On("ToApp").Return(nil) - s.Require().Nil(s.session.send(s.NewOrderSingle())) + s.Require().Nil(s.session.send(*s.NewOrderSingle())) s.LastToAppMessageSent() s.MockApp.AssertNumberOfCalls(s.T(), "ToAdmin", 2) @@ -280,7 +280,7 @@ func (s *InSessionTestSuite) TestFIXMsgInResendRequestDoNotSendApp() { s.LastToAdminMessageSent() s.MockApp.On("ToApp").Return(nil) - s.Require().Nil(s.session.send(s.NewOrderSingle())) + s.Require().Nil(s.session.send(*s.NewOrderSingle())) s.LastToAppMessageSent() s.session.Timeout(s.session, internal.NeedHeartbeat) diff --git a/latent_state.go b/latent_state.go index 3140ecdfc..e6e5bece4 100644 --- a/latent_state.go +++ b/latent_state.go @@ -8,7 +8,7 @@ func (state latentState) String() string { return "Latent State" } func (state latentState) IsLoggedOn() bool { return false } func (state latentState) IsConnected() bool { return false } -func (state latentState) FixMsgIn(session *session, msg Message) (nextState sessionState) { +func (state latentState) FixMsgIn(session *session, msg *Message) (nextState sessionState) { session.log.OnEventf("Invalid Session State: Unexpected Msg %v while in Latent state", msg) return state } diff --git a/logon_state.go b/logon_state.go index d2b04bb2b..04ceb15b5 100644 --- a/logon_state.go +++ b/logon_state.go @@ -9,7 +9,7 @@ type logonState struct{ connectedNotLoggedOn } func (s logonState) String() string { return "Logon State" } -func (s logonState) FixMsgIn(session *session, msg Message) (nextState sessionState) { +func (s logonState) FixMsgIn(session *session, msg *Message) (nextState sessionState) { msgType, err := msg.MsgType() if err != nil { return handleStateError(session, err) @@ -20,13 +20,13 @@ func (s logonState) FixMsgIn(session *session, msg Message) (nextState sessionSt return latentState{} } - if err := session.handleLogon(msg); err != nil { + if err := session.handleLogon(*msg); err != nil { switch err := err.(type) { case RejectLogon: session.log.OnEvent(err.Text) logout := session.buildLogout(err.Text) - if err := session.dropAndSendInReplyTo(logout, false, &msg); err != nil { + if err := session.dropAndSendInReplyTo(logout, false, msg); err != nil { session.logError(err) } diff --git a/logout_state.go b/logout_state.go index 3619546a4..071512ce1 100644 --- a/logout_state.go +++ b/logout_state.go @@ -6,7 +6,7 @@ type logoutState struct{ connectedNotLoggedOn } func (state logoutState) String() string { return "Logout State" } -func (state logoutState) FixMsgIn(session *session, msg Message) (nextState sessionState) { +func (state logoutState) FixMsgIn(session *session, msg *Message) (nextState sessionState) { nextState = inSession{}.FixMsgIn(session, msg) if nextState, ok := nextState.(latentState); ok { return nextState diff --git a/logout_state_test.go b/logout_state_test.go index ce1ae84b6..82bfca88d 100644 --- a/logout_state_test.go +++ b/logout_state_test.go @@ -89,7 +89,7 @@ func (s *LogoutStateTestSuite) TestFixMsgInLogoutResetOnLogout() { s.session.ResetOnLogout = true s.MockApp.On("ToApp").Return(nil) - s.Nil(s.queueForSend(s.NewOrderSingle())) + s.Nil(s.queueForSend(*s.NewOrderSingle())) s.MockApp.AssertExpectations(s.T()) s.MockApp.On("FromAdmin").Return(nil) diff --git a/message.go b/message.go index 8839e0722..f07060c73 100644 --- a/message.go +++ b/message.go @@ -89,6 +89,9 @@ type Message struct { //field bytes as they appear in the raw message fields TagValues + + //flag is true if this message should not be returned to pool after use + keepMessage bool } //ToMessage returns the message itself diff --git a/message_pool.go b/message_pool.go new file mode 100644 index 000000000..c690a030f --- /dev/null +++ b/message_pool.go @@ -0,0 +1,26 @@ +package quickfix + +type messagePool struct { + m []*Message +} + +func (p *messagePool) New() *Message { + msg := NewMessage() + return &msg +} + +func (p *messagePool) Get() (msg *Message) { + if len(p.m) > 0 { + msg, p.m = p.m[len(p.m)-1], p.m[:len(p.m)-1] + } else { + msg = p.New() + } + + msg.keepMessage = false + + return +} + +func (p *messagePool) Put(msg *Message) { + p.m = append(p.m, msg) +} diff --git a/not_session_time.go b/not_session_time.go index e9b589d85..2e3b04c3d 100644 --- a/not_session_time.go +++ b/not_session_time.go @@ -7,7 +7,7 @@ type notSessionTime struct{ latentState } func (notSessionTime) String() string { return "Not session time" } func (notSessionTime) IsSessionTime() bool { return false } -func (state notSessionTime) FixMsgIn(session *session, msg Message) (nextState sessionState) { +func (state notSessionTime) FixMsgIn(session *session, msg *Message) (nextState sessionState) { session.log.OnEventf("Invalid Session State: Unexpected Msg %v while in Latent state", msg) return state } diff --git a/quickfix_test.go b/quickfix_test.go index 13e78e66f..60fc8f2bf 100644 --- a/quickfix_test.go +++ b/quickfix_test.go @@ -119,7 +119,7 @@ func (m *MessageFactory) SetNextSeqNum(next int) { m.seqNum = next - 1 } -func (m *MessageFactory) buildMessage(msgType string) Message { +func (m *MessageFactory) buildMessage(msgType string) *Message { m.seqNum++ msg := NewMessage() msg.Header. @@ -129,26 +129,26 @@ func (m *MessageFactory) buildMessage(msgType string) Message { SetField(tagSendingTime, FIXUTCTimestamp{Time: time.Now()}). SetField(tagMsgSeqNum, FIXInt(m.seqNum)). SetField(tagMsgType, FIXString(msgType)) - return msg + return &msg } -func (m *MessageFactory) Logout() Message { +func (m *MessageFactory) Logout() *Message { return m.buildMessage(string(enum.MsgType_LOGOUT)) } -func (m *MessageFactory) NewOrderSingle() Message { +func (m *MessageFactory) NewOrderSingle() *Message { return m.buildMessage(string(enum.MsgType_ORDER_SINGLE)) } -func (m *MessageFactory) Heartbeat() Message { +func (m *MessageFactory) Heartbeat() *Message { return m.buildMessage(string(enum.MsgType_HEARTBEAT)) } -func (m *MessageFactory) Logon() Message { +func (m *MessageFactory) Logon() *Message { return m.buildMessage(string(enum.MsgType_LOGON)) } -func (m *MessageFactory) ResendRequest(beginSeqNo int) Message { +func (m *MessageFactory) ResendRequest(beginSeqNo int) *Message { msg := m.buildMessage(string(enum.MsgType_RESEND_REQUEST)) msg.Body.SetField(tagBeginSeqNo, FIXInt(beginSeqNo)) msg.Body.SetField(tagEndSeqNo, FIXInt(0)) @@ -156,7 +156,7 @@ func (m *MessageFactory) ResendRequest(beginSeqNo int) Message { return msg } -func (m *MessageFactory) SequenceReset(seqNo int) Message { +func (m *MessageFactory) SequenceReset(seqNo int) *Message { msg := m.buildMessage(string(enum.MsgType_SEQUENCE_RESET)) msg.Body.SetField(tagNewSeqNo, FIXInt(seqNo)) diff --git a/resend_state.go b/resend_state.go index 60e62d73f..36298ecc5 100644 --- a/resend_state.go +++ b/resend_state.go @@ -4,7 +4,7 @@ import "github.com/quickfixgo/quickfix/internal" type resendState struct { loggedOn - messageStash map[int]Message + messageStash map[int]*Message currentResendRangeEnd int resendRangeEnd int } @@ -25,7 +25,7 @@ func (s resendState) Timeout(session *session, event internal.Event) (nextState return } -func (s resendState) FixMsgIn(session *session, msg Message) (nextState sessionState) { +func (s resendState) FixMsgIn(session *session, msg *Message) (nextState sessionState) { nextState = inSession{}.FixMsgIn(session, msg) if !nextState.IsLoggedOn() { @@ -51,8 +51,12 @@ func (s resendState) FixMsgIn(session *session, msg Message) (nextState sessionS if !ok { break } + delete(s.messageStash, targetSeqNum) + //return stashed message to pool + session.messagePool.Put(msg) + nextState = inSession{}.FixMsgIn(session, msg) if !nextState.IsLoggedOn() { return diff --git a/session.go b/session.go index cee6708ea..dd08eaf3c 100644 --- a/session.go +++ b/session.go @@ -40,6 +40,8 @@ type session struct { admin chan interface{} internal.SessionSettings + + messagePool } func (s *session) logError(err error) { diff --git a/session_state.go b/session_state.go index 02ccc9915..8086560f9 100644 --- a/session_state.go +++ b/session_state.go @@ -69,17 +69,21 @@ func (sm *stateMachine) Incoming(session *session, m fixIn) { session.log.OnIncoming(m.bytes) - msg := NewMessage() - if err := ParseMessage(&msg, m.bytes); err != nil { + msg := session.messagePool.Get() + if err := ParseMessage(msg, m.bytes); err != nil { session.log.OnEventf("Msg Parse Error: %v, %q", err.Error(), m.bytes) } else { msg.ReceiveTime = m.receiveTime sm.fixMsgIn(session, msg) } + + if !msg.keepMessage { + session.messagePool.Put(msg) + } session.peerTimer.Reset(time.Duration(float64(1.2) * float64(session.HeartBtInt))) } -func (sm *stateMachine) fixMsgIn(session *session, m Message) { +func (sm *stateMachine) fixMsgIn(session *session, m *Message) { sm.setState(session, sm.State.FixMsgIn(session, m)) } @@ -195,7 +199,7 @@ func handleStateError(s *session, err error) sessionState { 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 - FixMsgIn(*session, Message) (nextState sessionState) + FixMsgIn(*session, *Message) (nextState sessionState) //Timeout is called by the session on a timeout event. Timeout(*session, internal.Event) (nextState sessionState) diff --git a/session_test.go b/session_test.go index 9e5a06e8d..4100ffe2d 100644 --- a/session_test.go +++ b/session_test.go @@ -449,7 +449,7 @@ func (s *SessionSuite) TestSendAppMessagesNotInSessionTime() { s.IncrNextTargetMsgSeqNum() s.MockApp.On("ToApp").Return(nil) - s.Require().Nil(s.queueForSend(s.NewOrderSingle())) + s.Require().Nil(s.queueForSend(*s.NewOrderSingle())) s.MockApp.AssertExpectations(s.T()) now := time.Now().UTC() @@ -670,7 +670,7 @@ func (suite *SessionSendTestSuite) SetupTest() { func (suite *SessionSendTestSuite) TestQueueForSendAppMessage() { suite.MockApp.On("ToApp").Return(nil) - require.Nil(suite.T(), suite.queueForSend(suite.NewOrderSingle())) + require.Nil(suite.T(), suite.queueForSend(*suite.NewOrderSingle())) suite.MockApp.AssertExpectations(suite.T()) suite.NoMessageSent() @@ -681,7 +681,7 @@ func (suite *SessionSendTestSuite) TestQueueForSendAppMessage() { func (suite *SessionSendTestSuite) TestQueueForSendDoNotSendAppMessage() { suite.MockApp.On("ToApp").Return(ErrDoNotSend) - suite.Equal(ErrDoNotSend, suite.queueForSend(suite.NewOrderSingle())) + suite.Equal(ErrDoNotSend, suite.queueForSend(*suite.NewOrderSingle())) suite.MockApp.AssertExpectations(suite.T()) suite.NoMessagePersisted(1) @@ -689,7 +689,7 @@ func (suite *SessionSendTestSuite) TestQueueForSendDoNotSendAppMessage() { suite.NextSenderMsgSeqNum(1) suite.MockApp.On("ToAdmin") - require.Nil(suite.T(), suite.send(suite.Heartbeat())) + require.Nil(suite.T(), suite.send(*suite.Heartbeat())) suite.MockApp.AssertExpectations(suite.T()) suite.LastToAdminMessageSent() @@ -699,7 +699,7 @@ func (suite *SessionSendTestSuite) TestQueueForSendDoNotSendAppMessage() { func (suite *SessionSendTestSuite) TestQueueForSendAdminMessage() { suite.MockApp.On("ToAdmin") - require.Nil(suite.T(), suite.queueForSend(suite.Heartbeat())) + require.Nil(suite.T(), suite.queueForSend(*suite.Heartbeat())) suite.MockApp.AssertExpectations(suite.T()) suite.MessagePersisted(suite.MockApp.lastToAdmin) @@ -709,7 +709,7 @@ func (suite *SessionSendTestSuite) TestQueueForSendAdminMessage() { func (suite *SessionSendTestSuite) TestSendAppMessage() { suite.MockApp.On("ToApp").Return(nil) - require.Nil(suite.T(), suite.send(suite.NewOrderSingle())) + require.Nil(suite.T(), suite.send(*suite.NewOrderSingle())) suite.MockApp.AssertExpectations(suite.T()) suite.MessagePersisted(suite.MockApp.lastToApp) @@ -719,7 +719,7 @@ func (suite *SessionSendTestSuite) TestSendAppMessage() { func (suite *SessionSendTestSuite) TestSendAppDoNotSendMessage() { suite.MockApp.On("ToApp").Return(ErrDoNotSend) - suite.Equal(ErrDoNotSend, suite.send(suite.NewOrderSingle())) + suite.Equal(ErrDoNotSend, suite.send(*suite.NewOrderSingle())) suite.MockApp.AssertExpectations(suite.T()) suite.NextSenderMsgSeqNum(1) @@ -728,7 +728,7 @@ func (suite *SessionSendTestSuite) TestSendAppDoNotSendMessage() { func (suite *SessionSendTestSuite) TestSendAdminMessage() { suite.MockApp.On("ToAdmin") - require.Nil(suite.T(), suite.send(suite.Heartbeat())) + require.Nil(suite.T(), suite.send(*suite.Heartbeat())) suite.MockApp.AssertExpectations(suite.T()) suite.LastToAdminMessageSent() @@ -738,8 +738,8 @@ func (suite *SessionSendTestSuite) TestSendAdminMessage() { func (suite *SessionSendTestSuite) TestSendFlushesQueue() { suite.MockApp.On("ToApp").Return(nil) suite.MockApp.On("ToAdmin") - require.Nil(suite.T(), suite.queueForSend(suite.NewOrderSingle())) - require.Nil(suite.T(), suite.queueForSend(suite.Heartbeat())) + require.Nil(suite.T(), suite.queueForSend(*suite.NewOrderSingle())) + require.Nil(suite.T(), suite.queueForSend(*suite.Heartbeat())) order1 := suite.MockApp.lastToApp heartbeat := suite.MockApp.lastToAdmin @@ -748,7 +748,7 @@ func (suite *SessionSendTestSuite) TestSendFlushesQueue() { suite.NoMessageSent() suite.MockApp.On("ToApp").Return(nil) - require.Nil(suite.T(), suite.send(suite.NewOrderSingle())) + require.Nil(suite.T(), suite.send(*suite.NewOrderSingle())) suite.MockApp.AssertExpectations(suite.T()) order2 := suite.MockApp.lastToApp suite.MessageSentEquals(order1) @@ -760,8 +760,8 @@ func (suite *SessionSendTestSuite) TestSendFlushesQueue() { func (suite *SessionSendTestSuite) TestSendNotLoggedOn() { suite.MockApp.On("ToApp").Return(nil) suite.MockApp.On("ToAdmin") - require.Nil(suite.T(), suite.queueForSend(suite.NewOrderSingle())) - require.Nil(suite.T(), suite.queueForSend(suite.Heartbeat())) + require.Nil(suite.T(), suite.queueForSend(*suite.NewOrderSingle())) + require.Nil(suite.T(), suite.queueForSend(*suite.Heartbeat())) suite.MockApp.AssertExpectations(suite.T()) suite.NoMessageSent() @@ -771,7 +771,7 @@ func (suite *SessionSendTestSuite) TestSendNotLoggedOn() { for _, test := range tests { suite.MockApp.On("ToApp").Return(nil) suite.session.State = test - require.Nil(suite.T(), suite.send(suite.NewOrderSingle())) + require.Nil(suite.T(), suite.send(*suite.NewOrderSingle())) suite.MockApp.AssertExpectations(suite.T()) suite.NoMessageSent() } @@ -784,7 +784,7 @@ func (suite *SessionSendTestSuite) TestSendEnableLastMsgSeqNumProcessed() { suite.Require().Nil(suite.session.store.SetNextTargetMsgSeqNum(45)) suite.MockApp.On("ToApp").Return(nil) - require.Nil(suite.T(), suite.send(suite.NewOrderSingle())) + require.Nil(suite.T(), suite.send(*suite.NewOrderSingle())) suite.MockApp.AssertExpectations(suite.T()) suite.LastToAppMessageSent() @@ -793,7 +793,7 @@ func (suite *SessionSendTestSuite) TestSendEnableLastMsgSeqNumProcessed() { func (suite *SessionSendTestSuite) TestDropAndSendAdminMessage() { suite.MockApp.On("ToAdmin") - suite.Require().Nil(suite.dropAndSend(suite.Heartbeat(), false)) + suite.Require().Nil(suite.dropAndSend(*suite.Heartbeat(), false)) suite.MockApp.AssertExpectations(suite.T()) suite.MessagePersisted(suite.MockApp.lastToAdmin) @@ -803,14 +803,14 @@ func (suite *SessionSendTestSuite) TestDropAndSendAdminMessage() { func (suite *SessionSendTestSuite) TestDropAndSendDropsQueue() { suite.MockApp.On("ToApp").Return(nil) suite.MockApp.On("ToAdmin") - require.Nil(suite.T(), suite.queueForSend(suite.NewOrderSingle())) - require.Nil(suite.T(), suite.queueForSend(suite.Heartbeat())) + require.Nil(suite.T(), suite.queueForSend(*suite.NewOrderSingle())) + require.Nil(suite.T(), suite.queueForSend(*suite.Heartbeat())) suite.MockApp.AssertExpectations(suite.T()) suite.NoMessageSent() suite.MockApp.On("ToAdmin") - require.Nil(suite.T(), suite.dropAndSend(suite.Logon(), false)) + require.Nil(suite.T(), suite.dropAndSend(*suite.Logon(), false)) suite.MockApp.AssertExpectations(suite.T()) msg := suite.MockApp.lastToAdmin @@ -825,13 +825,13 @@ func (suite *SessionSendTestSuite) TestDropAndSendDropsQueue() { func (suite *SessionSendTestSuite) TestDropAndSendDropsQueueWithReset() { suite.MockApp.On("ToApp").Return(nil) suite.MockApp.On("ToAdmin") - require.Nil(suite.T(), suite.queueForSend(suite.NewOrderSingle())) - require.Nil(suite.T(), suite.queueForSend(suite.Heartbeat())) + require.Nil(suite.T(), suite.queueForSend(*suite.NewOrderSingle())) + require.Nil(suite.T(), suite.queueForSend(*suite.Heartbeat())) suite.MockApp.AssertExpectations(suite.T()) suite.NoMessageSent() suite.MockApp.On("ToAdmin") - require.Nil(suite.T(), suite.dropAndSend(suite.Logon(), true)) + require.Nil(suite.T(), suite.dropAndSend(*suite.Logon(), true)) suite.MockApp.AssertExpectations(suite.T()) msg := suite.MockApp.lastToAdmin