diff options
author | Ermal <eri@pfsense.org> | 2010-09-07 19:36:53 +0000 |
---|---|---|
committer | Ermal <eri@pfsense.org> | 2010-09-07 19:36:53 +0000 |
commit | 0ae6daf8342d8a07d33bf6677ce9a228530defac (patch) | |
tree | 11e06c8535944fa24ba9ee9f8fba8e6d42380a0b /etc/inc/util.inc | |
parent | 298e5e0ab913f32759805b5dc5ba204eb3795609 (diff) | |
download | pfsense-0ae6daf8342d8a07d33bf6677ce9a228530defac.zip pfsense-0ae6daf8342d8a07d33bf6677ce9a228530defac.tar.gz |
Use the new events mechanisms to dispatch events.
Diffstat (limited to 'etc/inc/util.inc')
-rw-r--r-- | etc/inc/util.inc | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/etc/inc/util.inc b/etc/inc/util.inc index 96d10f5..30f4566 100644 --- a/etc/inc/util.inc +++ b/etc/inc/util.inc @@ -137,6 +137,36 @@ function unlock($cfglckkey = 0) { return; } +function send_event($cmd) { + global $g; + + $fd = fsockopen($g['event_address']); + if ($fd) { + fwrite($fd, $cmd); + $resp = fread($fd, 4096); + if ($resp != "OK\n") + log_error("send_event: sent {$cmd} got {$resp}"); + fclose($fd); + } +} + +function send_multiple_events($cmds) { + global $g; + + if (!is_array($cmds)) + return; + $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); + } +} + function refcount_init($reference) { $shmid = shmop_open($reference, "c", 0644, 10); shmop_write($shmid, 0, 0); @@ -1176,8 +1206,6 @@ function start_devd() { exec("/sbin/devd"); sleep(1); - if(file_exists("{$g['tmp_path']}/rc.linkup")) - unlink("{$g['tmp_path']}/rc.linkup"); } function is_interface_mismatch() { @@ -1207,7 +1235,7 @@ function is_interface_mismatch() { /* sync carp entries to other firewalls */ function carp_sync_client() { global $g; - touch($g['tmp_path'] . "/filter_sync"); + send_event("filter sync"); } /****f* util/isAjax |