From 9af4b31b7ab9a62e559ee097f77e1ccfb44e0964 Mon Sep 17 00:00:00 2001 From: Ermal Date: Wed, 31 Mar 2010 21:11:50 +0000 Subject: Use stristr as a microoptimization. --- etc/inc/gwlb.inc | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'etc') diff --git a/etc/inc/gwlb.inc b/etc/inc/gwlb.inc index 1b33cc1..3d95678 100644 --- a/etc/inc/gwlb.inc +++ b/etc/inc/gwlb.inc @@ -355,11 +355,11 @@ function return_gateway_groups_array() { if(($status['name'] != $gwname)) { continue; } - if (preg_match("/down/i", $status['status'])) { + if (stristr($status['status'], "down")) { $msg = "MONITOR: $gwname has high latency, removing from routing group"; log_error($msg); notify_via_growl($msg); - } elseif (preg_match("/loss/i", $status['status'])) { + } elseif (stristr($status['status'], "loss")) { if (strstr($group['trigger'], "loss")) { /* packet loss */ $msg = "MONITOR: $gwname has packet loss, removing from routing group"; @@ -368,7 +368,7 @@ function return_gateway_groups_array() { } else { $tiers[$tier][] = $gwname; } - } elseif (preg_match("/delay/i", $status['status'])) { + } elseif (stristr($status['status'], $delay)) { if (strstr($group['trigger'] , "latency")) { /* high latency */ $msg = "MONITOR: $gwname has high latency, removing from routing group"; @@ -377,7 +377,7 @@ function return_gateway_groups_array() { } else { $tiers[$tier][] = $gwname; } - } elseif (preg_match("/none/i", $status['status'])) { + } elseif (stristr($status['status'], "none")) { /* Online add member */ $tiers[$tier][] = $gwname; } -- cgit v1.1