[Quickfix-developers] SocketAcceptor::onPoll()
Brought to you by:
orenmnero
From: Peter P. <pet...@ho...> - 2009-03-04 19:48:58
|
Hi, I'm investigating a deadlock somewhere in my application that uses Quickfix, so I am squirreling through the source looking for likely culprits. The onPoll() member seems oddly constructed to me (source copied below). In particular: 1. Why have the test for start = 0, as it will always be zero at that point? (Not going to ask why those variables declared outside the if() scope!) 2. Why is start (an automatic and therefore local variable) reset to zero before the function returns and destroys it anyway? I looked at an earlier copy of quickfix (also confusingly called version 1.12.4) and the start variable does not exist at all in that version, so I'm confused as to why it should have ended up looking this messy? Anyone else think this is odd or am I having a bad hair day? Yours, Dan ----- code from Subversion repository version 1.12.4 as of 11 FEB 2009 ----- bool SocketAcceptor::onPoll( double timeout ) { QF_STACK_PUSH(SocketAcceptor::onPoll) if( !m_pServer ) return false; time_t start = 0; time_t now = 0; if( isStopped() ) { if( start == 0 ) ::time( &start ); if( !isLoggedOn() ) { start = 0; return false; } if( ::time(&now) - 5 >= start ) { start = 0; return false; } } m_pServer->block( *this, true, timeout ); return true; QF_STACK_POP } _________________________________________________________________ View your Twitter and Flickr updates from one place – Learn more! http://clk.atdmt.com/UKM/go/137984870/direct/01/ |