RE: [Quickfix-developers] SocketConnection session registration BUG
Brought to you by:
orenmnero
|
From: Sean K. <Sea...@Pi...> - 2005-06-28 13:52:50
|
Oren,
I will do as you have suggested. I appreciate you taking the time
to look into this. I will make the change below and test it out.
I'd like to offer my services to get some engine-level logging into
the next release of quickfix. It's a great product and this would
help cover any remaining unknowns about messaging prior to establishing
a logon. I'd be more than happy to follow any coding practices you
have so that the logging will integrate seamlessly. Please let me know
if you are interested in this.
Thanks again.
Sean
> -----Original Message-----
> From: Oren Miller [mailto:or...@qu...]
> Sent: Tuesday, June 28, 2005 9:27 AM
> To: Sean Kirkpatrick; qui...@li...
> Subject: Re: [Quickfix-developers] SocketConnection session=20
> registration
> BUG
>=20
>=20
> Sean,
>=20
> When applying your patch, other acceptance tests break. In=20
> fact it results=20
> in a crash during a typical multiple logon scenario. (If you=20
> run your=20
> acceptance tests, it should reveal the same thing to you). =20
> I've included=20
> another implementation of SocketConnection::read which passes all the=20
> acceptance tests and should also fix the bug you've reported.=20
> Please report=20
> back if that is the case:
>=20
> bool SocketConnection::read( SocketAcceptor& a, SocketServer& s )
> { QF_STACK_PUSH(SocketConnection::read)
>=20
> std::string msg;
> try
> {
> readFromSocket();
>=20
> if ( !m_pSession )
> {
> if ( !readMessage( msg ) ) return false;
> m_pSession =3D Session::lookupSession( msg, true );
> if( m_pSession &&=20
> Session::isSessionRegistered(m_pSession->getSessionID()) )
> m_pSession =3D 0;
> if( m_pSession )
> m_pSession =3D a.getSession( msg, *this );
> if( m_pSession )
> m_pSession->next( msg );
> if( !m_pSession )
> {
> s.getMonitor().drop( m_socket );
> return false;
> }
>=20
> Session::registerSession( m_pSession->getSessionID() );
> }
>=20
> 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;
>=20
> QF_STACK_POP
> }
> ----- Original Message -----=20
> From: "Sean Kirkpatrick" <Sea...@Pi...>
> To: <qui...@li...>
> Sent: Monday, June 27, 2005 10:34 AM
> Subject: [Quickfix-developers] SocketConnection session=20
> registration BUG
>=20
>=20
> QuickFIX Documentation:=20
> http://www.quickfixengine.org/quickfix/doc/html/index.html
> QuickFIX FAQ:=20
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=20
are
for the logging I added):
if ( m_pSession ) {
LOGDEBUG(funcname,"registering session=20
[%s]",m_pSession->getSessionID().toString().c_str());
m_pSession =3D Session::registerSession( m_pSession->getSessionID() =
);
}
if ( m_pSession ) {
LOGDEBUG(funcname,"getting SocketAcceptor session =
[%s]",msg.c_str());
m_pSession =3D a.getSession( msg, *this );
}
needs to be reversed to be:
if ( m_pSession ) {
LOGDEBUG(funcname,"getting SocketAcceptor session =
[%s]",msg.c_str());
m_pSession =3D a.getSession( msg, *this );
}
if ( m_pSession ) {
LOGDEBUG(funcname,"registering session=20
[%s]",m_pSession->getSessionID().toString().c_str());
m_pSession =3D Session::registerSession( m_pSession->getSessionID() =
);
}
|