[Quickfix-developers] stopping a single session
Brought to you by:
orenmnero
From: Mark T. K. <mke...@di...> - 2008-04-16 15:31:59
|
could those who really know the code comment on the following patch to Session.cpp (from the subversion trunk): Index: Session.cpp =================================================================== --- Session.cpp (revision 1944) +++ Session.cpp (working copy) @@ -213,6 +213,13 @@ return; } + if( !isEnabled() ) + { + m_state.onEvent( "Received logon but session is disabled" ); + disconnect(); + return; + } + ResetSeqNumFlag resetSeqNumFlag(false); if( logon.isSetField(resetSeqNumFlag) ) logon.getField( resetSeqNumFlag ); @@ -305,7 +312,10 @@ else m_state.onEvent( "Received logout response" ); - m_state.incrNextTargetMsgSeqNum(); + MsgSeqNum msgSeqNum; + logout.getHeader ().getField (msgSeqNum); + if (getExpectedTargetNum () == msgSeqNum) + m_state.incrNextTargetMsgSeqNum(); if ( m_resetOnLogout ) m_state.reset(); disconnect(); the first hunk causes an acceptor to refuse logon attempts after stop() has been called on it. thus, calling stop() and then waiting for isLoggedOn() to return false guarantees no more fromApp() or fromAdmin() callbacks. question: how do i prevent the acceptor from continuing to listen on the acceptor's port? the second hunk fixes what i think is a bug (that others have reported as well) in that sequence numbers can be inadvertently consumed by logout messages that are received out of sequence. all of the UT tests and the AT tests pass after this patch, although i don't know if the tests actually hit the new code. i'm looking for someone (e.g. oren) to say "yeah, that looks right" or maybe "bogus! do this instead." /mark kennedy This communication and any attachments may contain confidential/proprietary information and is intended for information purposes only. It is not an invitation or offer to purchase interests from Diamondback. Any representation to the contrary is unintentional. This communication is intended only for the person(s) to whom it is addressed. If you are not the intended recipient you are hereby notified that you have received this document in error and that any review, dissemination, distribution, or copying of this message or any attachments is not permitted. If you have received this in error, please notify the sender immediately by e-mail and delete this message. All e-mails sent to or received from this address will be received by Diamondback's company e-mail system and is subject to archival and possible review by someone other than the recipient. This notice is automatically appended to each e-mail message leaving Diamondback. |