Skip to content

Commit

Permalink
When ifSpeed is not returned by the switch, billing was broken.
Browse files Browse the repository at this point in the history
  • Loading branch information
guggemand committed Aug 1, 2016
1 parent 1fe3346 commit 09b4497
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions poll-billing.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ function CollectData($bill_id) {

$tmp_period = dbFetchCell("SELECT UNIX_TIMESTAMP(CURRENT_TIMESTAMP()) - UNIX_TIMESTAMP('".mres($last_counters['timestamp'])."')");

if ((delta_to_bits($port_data['in_measurement'], $tmp_period)-delta_to_bits($port_data['last_in_measurement'], $tmp_period)) > $port_data['ifSpeed']) {
if ($port_data['ifSpeed'] > 0 && (delta_to_bits($port_data['in_measurement'], $tmp_period)-delta_to_bits($port_data['last_in_measurement'], $tmp_period)) > $port_data['ifSpeed']) {
$port_data['in_delta'] = $port_data['last_in_delta'];
}
elseif ($port_data['in_measurement'] >= $port_data['last_in_measurement']) {
Expand All @@ -85,7 +85,7 @@ function CollectData($bill_id) {
$port_data['in_delta'] = $port_data['last_in_delta'];
}

if ((delta_to_bits($port_data['out_measurement'], $tmp_period)-delta_to_bits($port_data['last_out_measurement'], $tmp_period)) > $port_data['ifSpeed']) {
if ($port_data['ifSpeed'] > 0 && (delta_to_bits($port_data['out_measurement'], $tmp_period)-delta_to_bits($port_data['last_out_measurement'], $tmp_period)) > $port_data['ifSpeed']) {
$port_data['out_delta'] = $port_data['last_out_delta'];
}
elseif ($port_data['out_measurement'] >= $port_data['last_out_measurement']) {
Expand Down

0 comments on commit 09b4497

Please sign in to comment.