LCOV - code coverage report
Current view: top level - daemon - timer.cpp (source / functions) Coverage Total Hit
Test: coverage.info Lines: 100.0 % 9 9
Test Date: 2025-08-17 08:58:50 Functions: 100.0 % 3 3
Legend: Lines: hit not hit

            Line data    Source code
       1              : // Copyright (c) 2016-2025  Made to Order Software Corp.  All Rights Reserved
       2              : //
       3              : // https://snapwebsites.org/project/cluck
       4              : // contact@m2osw.com
       5              : //
       6              : // This program is free software: you can redistribute it and/or modify
       7              : // it under the terms of the GNU General Public License as published by
       8              : // the Free Software Foundation, either version 3 of the License, or
       9              : // (at your option) any later version.
      10              : //
      11              : // This program is distributed in the hope that it will be useful,
      12              : // but WITHOUT ANY WARRANTY; without even the implied warranty of
      13              : // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      14              : // GNU General Public License for more details.
      15              : //
      16              : // You should have received a copy of the GNU General Public License
      17              : // along with this program.  If not, see <https://www.gnu.org/licenses/>.
      18              : 
      19              : 
      20              : // self
      21              : //
      22              : #include    "timer.h"
      23              : 
      24              : #include    "cluckd.h"
      25              : 
      26              : 
      27              : // last include
      28              : //
      29              : #include    <snapdev/poison.h>
      30              : 
      31              : 
      32              : 
      33              : namespace cluck_daemon
      34              : {
      35              : 
      36              : 
      37              : 
      38              : /** \class timer
      39              :  * \brief Handle the timeouts.
      40              :  *
      41              :  * This class is used to time out locks. Whenever we receive a new LOCK
      42              :  * message or enter a lock the timer is reset with the next lock that is
      43              :  * going to time out. When that happens, the cleanup() function gets
      44              :  * called. Any lock which timed out is removed and the user on the other
      45              :  * end is told about the problem with an UNLOCKING, UNLOCKED or LOCK_FAILED
      46              :  * message as the case may be.
      47              :  */
      48              : 
      49              : 
      50              : 
      51              : /** \brief The timer initialization.
      52              :  *
      53              :  * The timer is always enabled, however by default there is nothing to
      54              :  * timeout. In other words, the timer is kept off.
      55              :  *
      56              :  * \param[in] c  The cluckd server which will handle time outs.
      57              :  */
      58           25 : timer::timer(cluckd * c)
      59              :     : ed::timer(-1)
      60           25 :     , f_cluckd(c)
      61              : {
      62           75 :     set_name("timer");
      63           25 : }
      64              : 
      65              : 
      66           25 : timer::~timer()
      67              : {
      68           25 : }
      69              : 
      70              : 
      71              : /** \brief Call the cleanup() function of the cluckd object.
      72              :  *
      73              :  * A timeout happened, call the cluckd::cleanup() function which takes
      74              :  * care of cleaning up the list of lock requests and existing locks that
      75              :  * timed out.
      76              :  */
      77            9 : void timer::process_timeout()
      78              : {
      79            9 :     f_cluckd->cleanup();
      80            9 : }
      81              : 
      82              : 
      83              : 
      84              : } // namespace cluck_daemon
      85              : // vim: ts=4 sw=4 et
        

Generated by: LCOV version 2.0-1

Snap C++ | List of projects | List of versions