#19476: Use conditional intervals in heartbeat_callback -------------------------------------------------+------------------------- Reporter: cypherpunks | Owner: Type: defect | Status: | needs_review Priority: Medium | Milestone: Tor: | 0.3.2.x-final Component: Core Tor/Tor | Version: Severity: Normal | Resolution: Keywords: tor-relay, heartbeat, usability, | Actual Points: review-group-20 | Parent ID: | Points: Reviewer: | Sponsor: -------------------------------------------------+-------------------------
Comment (by cypherpunks): The current behavior is to always call the heartbeat callback every `HeartbeatPeriod` seconds even if logging of the heartbeat has failed. The patch ensures the heartbeat callback is only called every `HeartbeatPeriod` seconds if logging of the heartbeat message was successful. Otherwise it will report to the scheduler that the callback should be called again in the next second. The only case where `log_heartbeat` returns != 0 is {{{ 103 if (public_server_mode(options) && !hibernating) { 104 /* Let's check if we are in the current cached consensus. */ 105 if (!(me = router_get_my_routerinfo())) 106 return -1; /* Something stinks, we won't even attempt this. */ 107 else 108 if (!node_get_by_id(me->cache_info.identity_digest)) 109 log_fn(LOG_NOTICE, LD_HEARTBEAT, "Heartbeat: It seems like we are not " 110 "in the cached consensus."); 111 } }}} So in the case when 'something stinks' the patch reschedules calling the callback in the next second instead of after `HeartbeartPeriod` seconds. -- Ticket URL: <https://trac.torproject.org/projects/tor/ticket/19476#comment:9> Tor Bug Tracker & Wiki <https://trac.torproject.org/> The Tor Project: anonymity online _______________________________________________ tor-bugs mailing list tor-bugs@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-bugs