uspot: accounting: avoid redundant assignments

Signed-off-by: Thibaut VARÈNE <hacks@slashdirt.org>
This commit is contained in:
Thibaut VARÈNE
2023-05-23 13:59:04 +02:00
committed by John Crispin
parent 1cded2e983
commit 3e483bd524

View File

@@ -177,18 +177,11 @@ function client_add(interface, mac, state) {
if (state.state != 1) if (state.state != 1)
return; return;
let interval = acct_interval(interface) * 1000;
let idle = idle_timeout(interface);
let session = session_timeout(interface);
let accounting = (config[interface]?.acct_server && config[interface]?.acct_secret); let accounting = (config[interface]?.acct_server && config[interface]?.acct_secret);
let max_total = 0; let interval = (state.data?.radius?.reply['Acct-Interim-Interval'] || acct_interval(interface)) * 1000;
let session = (state.data?.radius?.reply['Session-Timeout'] || session_timeout(interface));
if (state.data?.radius?.reply) { let idle = (state.data?.radius?.reply['Idle-Timeout'] || idle_timeout(interface));
interval = (state.data?.radius?.reply['Acct-Interim-Interval'] || acct_interval(interface)) * 1000; let max_total = (state.data?.radius?.reply['ChilliSpot-Max-Total-Octets'] || 0);
idle = (state.data?.radius?.reply['Idle-Timeout'] || idle_timeout(interface));
session = (state.data?.radius?.reply['Session-Timeout'] || session_timeout(interface));
max_total = (state.data?.radius?.reply['ChilliSpot-Max-Total-Octets'] || 0);
}
clients[interface][mac] = { clients[interface][mac] = {
accounting, accounting,