Re: [Quickfix-developers] SocketConnection session registration BUG
Brought to you by:
orenmnero
|
From: Oren M. <or...@qu...> - 2005-06-28 13:27:38
|
Sean,
When applying your patch, other acceptance tests break. In fact it results
in a crash during a typical multiple logon scenario. (If you run your
acceptance tests, it should reveal the same thing to you). I've included
another implementation of SocketConnection::read which passes all the
acceptance tests and should also fix the bug you've reported. Please report
back if that is the case:
bool SocketConnection::read( SocketAcceptor& a, SocketServer& s )
{ QF_STACK_PUSH(SocketConnection::read)
std::string msg;
try
{
readFromSocket();
if ( !m_pSession )
{
if ( !readMessage( msg ) ) return false;
m_pSession = Session::lookupSession( msg, true );
if( m_pSession &&
Session::isSessionRegistered(m_pSession->getSessionID()) )
m_pSession = 0;
if( m_pSession )
m_pSession = a.getSession( msg, *this );
if( m_pSession )
m_pSession->next( msg );
if( !m_pSession )
{
s.getMonitor().drop( m_socket );
return false;
}
Session::registerSession( m_pSession->getSessionID() );
}
readMessages( s.getMonitor() );
return true;
}
catch ( SocketRecvFailed& e )
{
if( m_pSession )
m_pSession->getLog()->onEvent( e.what() );
s.getMonitor().drop( m_socket );
}
catch ( InvalidMessage& )
{
s.getMonitor().drop( m_socket );
}
return false;
QF_STACK_POP
}
----- Original Message -----
From: "Sean Kirkpatrick" <Sea...@Pi...>
To: <qui...@li...>
Sent: Monday, June 27, 2005 10:34 AM
Subject: [Quickfix-developers] SocketConnection session registration BUG
QuickFIX Documentation:
http://www.quickfixengine.org/quickfix/doc/html/index.html
QuickFIX FAQ: http://www.quickfixengine.org/wikifix/index.php?QuickFixFAQ
QuickFIX Support: http://www.quickfixengine.org/services.html
I believe that there is a very simple fix that will correct this issue. The
order of the following code in SocketConnection::read (the LOGDEBUG lines
are
for the logging I added):
if ( m_pSession ) {
LOGDEBUG(funcname,"registering session
[%s]",m_pSession->getSessionID().toString().c_str());
m_pSession = Session::registerSession( m_pSession->getSessionID() );
}
if ( m_pSession ) {
LOGDEBUG(funcname,"getting SocketAcceptor session [%s]",msg.c_str());
m_pSession = a.getSession( msg, *this );
}
needs to be reversed to be:
if ( m_pSession ) {
LOGDEBUG(funcname,"getting SocketAcceptor session [%s]",msg.c_str());
m_pSession = a.getSession( msg, *this );
}
if ( m_pSession ) {
LOGDEBUG(funcname,"registering session
[%s]",m_pSession->getSessionID().toString().c_str());
m_pSession = Session::registerSession( m_pSession->getSessionID() );
}
|