mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 12:23:32 +01:00
Fix bug when disabling heartbeats.
Callbacks can't return 0.
This commit is contained in:
parent
e718a582af
commit
f038e9cb00
3
changes/bug19454
Normal file
3
changes/bug19454
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
o Minor bugfixes (heartbeat):
|
||||||
|
- Fix regression that crashes Tor when disabling heartbeats. Fixes bug
|
||||||
|
19454; bugfix on tor-0.2.8.1-alpha. Reported by "kubaku".
|
@ -2004,18 +2004,24 @@ check_fw_helper_app_callback(time_t now, const or_options_t *options)
|
|||||||
return PORT_FORWARDING_CHECK_INTERVAL;
|
return PORT_FORWARDING_CHECK_INTERVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Callback to write heartbeat message in the logs. */
|
||||||
static int
|
static int
|
||||||
heartbeat_callback(time_t now, const or_options_t *options)
|
heartbeat_callback(time_t now, const or_options_t *options)
|
||||||
{
|
{
|
||||||
static int first = 1;
|
static int first = 1;
|
||||||
/* 12. write the heartbeat message */
|
|
||||||
|
/* Check if heartbeat is disabled */
|
||||||
|
if (!options->HeartbeatPeriod) {
|
||||||
|
return PERIODIC_EVENT_NO_UPDATE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Write the heartbeat message */
|
||||||
if (first) {
|
if (first) {
|
||||||
first = 0; /* Skip the first one. */
|
first = 0; /* Skip the first one. */
|
||||||
} else {
|
} else {
|
||||||
log_heartbeat(now);
|
log_heartbeat(now);
|
||||||
}
|
}
|
||||||
/* XXXX This isn't such a good way to handle possible changes in the
|
|
||||||
* callback event */
|
|
||||||
return options->HeartbeatPeriod;
|
return options->HeartbeatPeriod;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user