Re: [Quickfix-developers] empty sequence number on sequence reset message
Brought to you by:
orenmnero
From: Oren M. <or...@qu...> - 2004-12-15 16:41:12
|
RE: [Quickfix-developers] empty sequence number on sequence reset = messageServes me right for not writing a proper functional test for = this. I'll reopen this issue and do it right this time :( --oren ----- Original Message -----=20 From: Michael Raykh=20 To: 'Oren Miller' ; Michael Raykh=20 Cc: 'qui...@li...'=20 Sent: Wednesday, December 15, 2004 10:34 AM Subject: RE: [Quickfix-developers] empty sequence number on sequence = reset message Reported this issue a while back, there was a fix (Session.cpp - = version 1.54-->1.55),=20 but issue is still there:=20 message.getHeader().getField( msgType );=20 if( message.getHeader().isSetField( msgSeqNum ) )=20 message.getHeader().getField( msgSeqNum );=20 if ( message.getHeader().isSetField( possDupFlag ) )=20 message.getHeader().getField( possDupFlag );=20 reject.setField( RefSeqNum( msgSeqNum ) );=20 Instead of line message.getHeader().getField( msgSeqNum ) as = originally,=20 now exception is thrown in reject.setField( RefSeqNum( msgSeqNum ) );=20 -----Original Message-----=20 From: Oren Miller [mailto:or...@qu...]=20 Sent: Thursday, November 04, 2004 10:54 AM=20 To: Michael Raykh=20 Cc: 'qui...@li...'=20 Subject: Re: [Quickfix-developers] empty sequence number on sequence=20 reset message=20 Well, when a sequence reset is sent in reset mode (123=3DN) the spec = says=20 that you should ignore the MsgSeqNum. I guess Appia took this to mean = that they can choose to just not send it, even though it is listed as = a=20 required field (not conditionally required) in the standard header.=20 First thing that we should do is have QF gracefully handle rejecting a = message without a sequence number. This should be accomplished easily = enough by replacing that line with this:=20 if( message.getHeader().isSetField( msgSeqNum ) )=20 message.getHeader().getField( msgSeqNum );=20 This will essentially cause the reject message to say it is rejecting=20 the message with sequence number 0, which I think is a reasonable = thing=20 to say if there is no sequence number.=20 Now the question is do we want to make an exception for this message=20 type and process the message that doesn't contain this required field. = =20 I would say since it is our job to "ignore" it, than yes, we should=20 probably allow it. To accomplish this we will need to allow the=20 nextSequenceReset method to specify that the validate method should=20 ignore sequence numbers. We can probably do this by rewriting the=20 method like so:=20 bool Session::verify( const Message& msg, bool checkTooHigh,=20 bool checkTooLow, bool checkSequenceNumber )=20 { QF_STACK_PUSH(Session::verify)=20 SenderCompID senderCompID;=20 TargetCompID targetCompID;=20 SendingTime sendingTime;=20 MsgType msgType;=20 MsgSeqNum msgSeqNum;=20 try=20 {=20 const Header& header =3D msg.getHeader();=20 header.getField( senderCompID );=20 header.getField( targetCompID );=20 header.getField( sendingTime );=20 header.getField( msgType );=20 if( checkSequenceNumber )=20 header.getField( msgSeqNum );=20 if ( !validLogonState( msgType ) )=20 throw std::logic_error( "Logon state is not valid for message" = );=20 if ( !isGoodTime( sendingTime ) )=20 {=20 doBadTime( msg );=20 return false;=20 }=20 if ( !isCorrectCompID( senderCompID, targetCompID ) )=20 {=20 doBadCompID( msg );=20 return false;=20 }=20 if ( checkSequenceNumber && checkTooHigh && isTargetTooHigh(=20 msgSeqNum ) )=20 {=20 doTargetTooHigh( msg );=20 return false;=20 }=20 else if ( checkSequenceNumber && checkTooLow && isTargetTooLow(=20 msgSeqNum ) )=20 {=20 doTargetTooLow( msg );=20 return false;=20 }=20 UtcTimeStamp now;=20 m_state.lastReceivedTime( now );=20 m_state.testRequest( 0 );=20 }=20 catch ( std::exception& e )=20 {=20 m_state.onEvent( e.what() );=20 disconnect();=20 return false;=20 }=20 fromCallback( msgType, msg, m_sessionID );=20 return true;=20 QF_STACK_POP=20 }=20 On Nov 4, 2004, at 8:33 AM, Michael Raykh wrote:=20 > In our test of quickFix against Appia fix engine the following = happens:=20 >=20 > - Appia sends sequence reset request msg=20 > - for some reason sequence number field is not populated on this = reset=20 > request=20 > - quickFix decides to reject this=20 > - crashes in generateReject in=20 > message.getHeader().getField( msgSeqNum );=20 > 'cause message seq number is not set...=20 >=20 >=20 >=20 > Is this proper behaviour? Any suggestions how to handle this?=20 > This email and any files transmitted with it are confidential and=20 > intended solely for the use of the individual or entity to whom they = > are addressed. If you have received this email in error please = notify=20 > the system manager. This message contains confidential information = and=20 > is intended only for the individual named. If you are not the named=20 > addressee you should not disseminate, distribute or copy this = e-mail.=20 This email and any files transmitted with it are confidential and = intended solely for the use of the individual or entity to whom they are = addressed. If you have received this email in error please notify the = system manager. This message contains confidential information and is = intended only for the individual named. If you are not the named = addressee you should not disseminate, distribute or copy this e-mail. |