LCOV - code coverage report
Current view: top level - irohad/consensus/yac/impl - timer_impl.cpp (source / functions) Hit Total Coverage
Test: cleared_cor.info Lines: 8 8 100.0 %
Date: 2019-03-07 14:46:43 Functions: 13 14 92.9 %

          Line data    Source code
       1             : /**
       2             :  * Copyright Soramitsu Co., Ltd. All Rights Reserved.
       3             :  * SPDX-License-Identifier: Apache-2.0
       4             :  */
       5             : 
       6             : #include "consensus/yac/impl/timer_impl.hpp"
       7             : #include <iostream>
       8             : 
       9             : namespace iroha {
      10             :   namespace consensus {
      11             :     namespace yac {
      12             :       TimerImpl::TimerImpl(
      13             :           std::function<rxcpp::observable<TimeoutType>()> invoke_delay)
      14         251 :           : invoke_delay_(std::move(invoke_delay)) {}
      15             : 
      16             :       void TimerImpl::invokeAfterDelay(std::function<void()> handler) {
      17         434 :         deny();
      18         434 :         handle_ = invoke_delay_().subscribe(
      19             :             [handler{std::move(handler)}](auto) { handler(); });
      20         434 :       }
      21             : 
      22             :       void TimerImpl::deny() {
      23        3817 :         handle_.unsubscribe();
      24        3817 :       }
      25             : 
      26             :       TimerImpl::~TimerImpl() {
      27         251 :         deny();
      28         251 :       }
      29             :     }  // namespace yac
      30             :   }    // namespace consensus
      31             : }  // namespace iroha

Generated by: LCOV version 1.13