[Quickfix-users] SocketConnection::read( SocketConnector& s ) doesn't catch RecvFailed exception
Brought to you by:
orenmnero
|
From: Brendan B. B. <br...@ka...> - 2003-07-09 13:09:01
|
Hello,
bool SocketConnection::readMessage( std::string& msg ) calls
m_parser.readFixMessage( msg ); which calls Parser::readFromStream()
which can throw a RecvFailed exception.
Callers of SocketConnection::readMessage(...) are:
bool SocketConnection::read( SocketAcceptor& a, SocketServer& s )
bool SocketConnection::read( SocketConnector& s )
void ThreadedSocketConnection::processStream()
Only SocketConnection::read( SocketAcceptor& a, SocketServer& s )
catches the exception:
catch ( RecvFailed& )
{
s.getMonitor().drop( m_socket );
}
Shouldn't SocketConnection::read( SocketConnector& s ) (and
ThreadedSocketConnection::processStream(), I haven't used it) do
something similar e.g.
bool SocketConnection::read( SocketConnector& s )
{ QF_STACK_PUSH(SocketConnection::read)
#if 1
// brendan 7/9/03
if ( !m_pSession ) return false;
std::string msg;
try
{
if ( !readMessage( msg ) ) return false;
m_pSession->next( msg );
}
catch ( InvalidMessage& )
{
return false;
}
catch ( RecvFailed& )
{
if ( !m_pSession->isLoggedOn() )
s.getMonitor().drop( m_socket );
return false;
}
return true;
#else
// orig
if ( !m_pSession ) return false;
std::string msg;
if ( !readMessage( msg ) ) return false;
try
{
m_pSession->next( msg );
}
catch ( InvalidMessage& ) {}
return true;
#endif // #if 1
QF_STACK_POP
}
?
I don't think this is a complete fix - when I've been able to cause
the exception to be thrown and then let it go VC++ then proceeds to
take 50-90% CPU. The only way I've been able to get out of that
state is to terminate the MSDEV.EXE process using TaskMan.
Regards,
Brendan
|