aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Ullrich <sullrich@pfsense.org>2007-01-28 01:10:01 +0000
committerScott Ullrich <sullrich@pfsense.org>2007-01-28 01:10:01 +0000
commitce1646e6b92e57708a3a1e43eafe598d86d380b1 (patch)
treee3e9a36ad53bb569b1e7a48d57b537b6bb1858bb
parent3c98b4673e5faf989bbfd11e1429be6251d0f159 (diff)
downloadpfsense-packages-ce1646e6b92e57708a3a1e43eafe598d86d380b1.tar.gz
pfsense-packages-ce1646e6b92e57708a3a1e43eafe598d86d380b1.tar.bz2
pfsense-packages-ce1646e6b92e57708a3a1e43eafe598d86d380b1.zip
Simplify code by returning "DOWN" or "UP". True and false can be quite confusing for these cases.
-rw-r--r--packages/tinydns/tinydns.inc14
1 files changed, 7 insertions, 7 deletions
diff --git a/packages/tinydns/tinydns.inc b/packages/tinydns/tinydns.inc
index 5e0c5804..bfdee609 100644
--- a/packages/tinydns/tinydns.inc
+++ b/packages/tinydns/tinydns.inc
@@ -156,19 +156,19 @@ function tinydns_get_record_status($record, $pingthreshold = "", $wanpingthresho
if(file_exists("/var/db/pingstatus/{$record}")) {
$status = file_get_contents("/var/db/pingstatus/{$record}");
if(stristr($status,"DOWN"))
- return false;
+ return "DOWN";
}
if($pingthreshold) {
$current_ms = file_get_contents("/var/db/pingmsstatus/$record");
if($pingthreshold > $current_ms)
- return false;
+ return "DOWN";
}
if($wanpingthreshold) {
$current_avg = file_get_contents("/var/db/wanaverage");
if($wanpingthreshold > $current_avg)
- return false;
+ return "DOWN";
}
- return true;
+ return "UP";
}
function tinydns_get_backup_record($record) {
@@ -181,7 +181,7 @@ function tinydns_get_backup_record($record) {
return $record;
foreach($domain['row'] as $row) {
$status = tinydns_get_record_status($row['failoverip']);
- if($status)
+ if($status == "DOWN")
return $row['failoverip'];
}
}
@@ -253,7 +253,7 @@ function tinydns_create_zone_file() {
$monitorip = $domain['monitorip'];
if($monitorip) {
$status = tinydns_get_record_status($monitorip);
- if(!$status)
+ if($status == "DOWN")
$ipaddress = tinydns_get_backup_record($ipaddress);
}
$record_data = tinydns_get_rowline_data($ipaddress, $domain['recordtype'], $ttl, $hostname);
@@ -272,7 +272,7 @@ function tinydns_create_zone_file() {
else
$wanpingthreshold = "";
$status = tinydns_get_record_status($row['failoverip'], $pingthreshold, $wanpingthreshold);
- if($status) {
+ if($status == "DOWN") {
$record_data = tinydns_get_rowline_data($row['failoverip'], $domain['recordtype'], $ttl, $hostname);
fwrite($fd, $record_data . "\n");
}