[Quickfix-developers] sequence reset loop when receiving invalid messages
Brought to you by:
orenmnero
|
From: Van G. E. (K. 41) <edd...@cr...> - 2003-07-11 06:57:27
|
Hi,
when receiving a FIX message with e.g. two times the same field, the message is discarted. Upon the next valid message, a sequence number mismatch is detected and a sequence reset is sent. The remote engine resends the invalid message and we enter an infinite loop.
I've trace the problem to
void Session::next( const std::string& msg )
{ QF_STACK_PUSH(Session::next)
m_state.onIncoming( msg );
next( Message( msg, m_dataDictionary ) );
QF_STACK_POP }
The problem is encountered in next( Message( msg, m_dataDictionary );
the next loop is not executed and the sequence number not increased
if the Message constructor throws an InvalidMessage.
I've solved the problem by catching the InvalidMessage
void Session::next( const std::string& msg )
{ QF_STACK_PUSH(Session::next)
m_state.onIncoming( msg );
try {
Message my_msg( msg, m_dataDictionary );
next( my_msg );
}
catch ( InvalidMessage& )
{
m_state.onIncoming( "INVALID MESSAGE RECEIVED" );
Message my_msg ( msg, false );
generateReject(my_msg,13);
m_state.incrNextTargetMsgSeqNum();
}
Unfortunately I do not know the exact reject reason
I put 13 ( TAG_APPEARS_MORE_THAN_ONCE ) because that was the case here.
Could another Message constructor be used and the message validation be left for
void Session::next( const Message& message ) ?
best regards,
Eddy Van Gelder
|