diff options
author | Ermal <eri@pfsense.org> | 2012-06-07 08:27:47 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2012-06-07 08:27:47 +0000 |
commit | 915089b7cdc03cd6c91fd282333e3cb3cd7fd1d0 (patch) | |
tree | a01156abde220b1470f2298b498e078f6f567509 | |
parent | 30fb05274eefdc85789116ddbb29399fe2e60505 (diff) | |
download | pfsense-915089b7cdc03cd6c91fd282333e3cb3cd7fd1d0.zip pfsense-915089b7cdc03cd6c91fd282333e3cb3cd7fd1d0.tar.gz |
Catch up with multiple events sending. Also do not blindly startup check_reload_status check first
-rw-r--r-- | etc/inc/util.inc | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 45d9f72..3669996 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -154,7 +154,7 @@ function send_event($cmd) { log_error("send_event: sent {$cmd} got {$resp}"); fclose($fd); $try = 3; - } else + } else if (!is_process_running("check_reload_status")) mwexec_bg("/usr/bin/nice -n20 /usr/local/sbin/check_reload_status"); $try++; } @@ -169,8 +169,21 @@ function send_multiple_events($cmds) { if (!is_array($cmds)) return; - foreach ($cmds as $cmd) - send_event($cmd); + while ($try < 3) { + $fd = @fsockopen($g['event_address']); + if ($fd) { + foreach ($cmds as $cmd) { + fwrite($fd, $cmd); + $resp = fread($fd, 4096); + if ($resp != "OK\n") + log_error("send_event: sent {$cmd} got {$resp}"); + } + fclose($fd); + $try = 3; + } else if (!is_process_running("check_reload_status")) + mwexec_bg("/usr/bin/nice -n20 /usr/local/sbin/check_reload_status"); + $try++; + } } function refcount_init($reference) { |