From: Amos Jeffries Date: Fri, 21 Mar 2008 09:45:33 +0000 (+1200) Subject: Compile errors in auto-testing. X-Git-Tag: BASIC_TPROXY4~16 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6289f91ff5634bcc1588c2937a5642c5857168b3;p=thirdparty%2Fsquid.git Compile errors in auto-testing. Also some auto-documentation. --- diff --git a/src/EventLoop.cc b/src/EventLoop.cc index dc45f68d8d..39c18c2e75 100644 --- a/src/EventLoop.cc +++ b/src/EventLoop.cc @@ -103,7 +103,7 @@ EventLoop::runOnce() bool sawActivity = false; runOnceResult = true; error = false; - loop_delay = 1000; /* 1s default delay */ + loop_delay = EVENT_LOOP_TIMEOUT; AsyncEngine *waitingEngine = primaryEngine; if (!waitingEngine && !engines.empty()) diff --git a/src/EventLoop.h b/src/EventLoop.h index 1262295be2..5b3adc99c7 100644 --- a/src/EventLoop.h +++ b/src/EventLoop.h @@ -1,4 +1,3 @@ - /* * $Id: EventLoop.h,v 1.4 2008/02/12 23:49:44 rousskov Exp $ * @@ -39,34 +38,39 @@ #include "AsyncEngine.h" #include "SquidTime.h" -/* An event loop. An event loop is the core inner loop of squid. +#define EVENT_LOOP_TIMEOUT 1000 /* 1s timeout */ + +/** An event loop. An event loop is the core inner loop of squid. * The event loop can be run until exit, or once. After it finishes control * returns to the caller. If desired it can be run again. - * + \par * The event loop cannot be run once it is running until it has finished. */ - class EventLoop { public: EventLoop(); - /* register an async engine which will be given the opportunity to perform + + /** register an async engine which will be given the opportunity to perform * in-main-thread tasks each event loop. */ void registerEngine(AsyncEngine *engine); - /* start the event loop running. The loop will run until it is stopped by + + /** start the event loop running. The loop will run until it is stopped by * calling stop(), or when the loop is completely idle - nothing * dispatched in a loop, and all engines idle. */ void run(); - /* run the loop once. This may not complete all events! It should therefor + + /** run the loop once. This may not complete all events! It should therefor * be used with care. * TODO: signal in runOnce whether or not the loop is over - IDLE vs OK vs * TIMEOUT? */ bool runOnce(); - /* set the primary async engine. The primary async engine recieves the + + /** set the primary async engine. The primary async engine recieves the * lowest requested timeout gathered from the other engines each loop. * (There is a default of 10ms if all engines are idle or request higher * delays). @@ -74,11 +78,13 @@ public: * implicitly the default. */ void setPrimaryEngine(AsyncEngine * engine); - /* set the time service. There can be only one time service set at any + + /** set the time service. There can be only one time service set at any * time. The time service is invoked on each loop */ void setTimeService(TimeEngine *engine); - /* stop the event loop - it will finish the current loop and then return to the + + /** stop the event loop - it will finish the current loop and then return to the * caller of run(). */ void stop(); @@ -86,11 +92,13 @@ public: int errcount; private: - /* setup state variables prior to running */ + /** setup state variables prior to running */ void prepareToRun(); - /* check an individual engine */ + + /** check an individual engine */ void checkEngine(AsyncEngine * engine, bool const primary); - /* dispatch calls and events scheduled during checkEngine() */ + + /** dispatch calls and events scheduled during checkEngine() */ bool dispatchCalls(); bool last_loop; @@ -98,9 +106,9 @@ private: engine_vector engines; TimeEngine * timeService; AsyncEngine * primaryEngine; - int loop_delay; /* the delay to be given to the primary engine */ - bool error; /* has an error occured in this loop */ - bool runOnceResult; /* the result from runOnce */ + int loop_delay; /**< the delay to be given to the primary engine */ + bool error; /**< has an error occured in this loop */ + bool runOnceResult; /**< the result from runOnce */ }; diff --git a/src/tests/stub_HttpReply.cc b/src/tests/stub_HttpReply.cc index 94ba11599a..51b8a2db2a 100644 --- a/src/tests/stub_HttpReply.cc +++ b/src/tests/stub_HttpReply.cc @@ -45,12 +45,6 @@ HttpReply::~HttpReply() fatal ("Not implemented."); } -void -HttpReply::absorb(HttpReply * new_rep) -{ - fatal ("Not implemented"); -} - void HttpReply::setHeaders(HttpVersion ver, http_status status, const char *reason, const char *ctype, int64_t clen, time_t lmt, time_t expires) diff --git a/src/tests/testEventLoop.cc b/src/tests/testEventLoop.cc index 06fbd444ef..dc16ab8889 100644 --- a/src/tests/testEventLoop.cc +++ b/src/tests/testEventLoop.cc @@ -278,7 +278,7 @@ testEventLoop::testSetPrimaryEngine() /* one engine - gets a timeout */ theLoop.registerEngine(&first_engine); theLoop.runOnce(); - CPPUNIT_ASSERT_EQUAL(10, first_engine.lasttimeout); + CPPUNIT_ASSERT_EQUAL(EVENT_LOOP_TIMEOUT, first_engine.lasttimeout); /* two engines - the second gets the timeout */ theLoop.registerEngine(&second_engine); theLoop.runOnce(); @@ -289,5 +289,4 @@ testEventLoop::testSetPrimaryEngine() theLoop.runOnce(); CPPUNIT_ASSERT_EQUAL(10, first_engine.lasttimeout); CPPUNIT_ASSERT_EQUAL(0, second_engine.lasttimeout); - }