Trying to fix processing

This commit is contained in:
stephb9959
2021-03-31 22:28:44 -07:00
parent 5f6723ab39
commit da5b4b5561
2 changed files with 8 additions and 8 deletions

View File

@@ -216,7 +216,7 @@ process( M, CS ) when is_record(M,mqtt_connack_variable_header_v4) ->
case M#mqtt_connack_variable_header_v4.connect_reason_code of case M#mqtt_connack_variable_header_v4.connect_reason_code of
0 -> 0 ->
{ok,TRef} = timer:apply_interval(60*1000,?MODULE,send_ping,[self()]), {ok,TRef} = timer:apply_interval(60*1000,?MODULE,send_ping,[self()]),
{ok,TReportTimer} = timer:send_interval(20*1000,self(),send_report), {ok,TReportTimer} = timer:send_interval(30*1000,self(),send_report),
ConnectTime = os:system_time() - CS#client_state.t1, ConnectTime = os:system_time() - CS#client_state.t1,
CS#client_state.manager_pid ! { stats, connect_time , ConnectTime }, CS#client_state.manager_pid ! { stats, connect_time , ConnectTime },
{none,CS#client_state{ start_time = os:system_time(), {none,CS#client_state{ start_time = os:system_time(),

View File

@@ -32,7 +32,7 @@ start(CAName, ID, Options, ManagerPID ) ->
%% io:format("OVSDB_AP: ID=~p~n",[ID]), %% io:format("OVSDB_AP: ID=~p~n",[ID]),
{ ok, ClientInfo } = inventory:get_record(#client_info{name = ID}), { ok, ClientInfo } = inventory:get_record(#client_info{name = ID}),
{ok,[HardwareInfo]} = hardware:get_by_id(ClientInfo#client_info.id), {ok,[HardwareInfo]} = hardware:get_by_id(ClientInfo#client_info.id),
{ok, ReportTimer } = timer:send_interval(15000,send_report), {ok, ReportTimer } = timer:send_interval(20000,send_report),
Redirector = maps:get(redirector,Options,<<"">>), Redirector = maps:get(redirector,Options,<<"">>),
CurrentState = #ap_state{ CurrentState = #ap_state{
id = ID, id = ID,
@@ -175,19 +175,19 @@ message_loop(APS) ->
?L_IA("~p: Resetting Wifi_Associated_Clients table.~n",[APS#ap_state.id]), ?L_IA("~p: Resetting Wifi_Associated_Clients table.~n",[APS#ap_state.id]),
NewState = send_associated_clients_table(false,APS), NewState = send_associated_clients_table(false,APS),
message_loop(NewState#ap_state{ check_monitor_tick = NewState#ap_state.check_monitor_tick+1 }); message_loop(NewState#ap_state{ check_monitor_tick = NewState#ap_state.check_monitor_tick+1 });
3 -> 4 ->
?L_IA("~p: Sending Wifi_Associated_Clients table.~n",[APS#ap_state.id]), ?L_IA("~p: Sending Wifi_Associated_Clients table.~n",[APS#ap_state.id]),
NewState = send_associated_clients_table(true,APS), NewState = send_associated_clients_table(true,APS),
message_loop(NewState#ap_state{ check_monitor_tick = NewState#ap_state.check_monitor_tick+1 }); message_loop(NewState#ap_state{ check_monitor_tick = NewState#ap_state.check_monitor_tick+1 });
4 -> 6 ->
?L_IA("~p: Resetting DHCP_Leased_IP table.~n",[APS#ap_state.id]), ?L_IA("~p: Resetting DHCP_Leased_IP table.~n",[APS#ap_state.id]),
NewState = send_dhcp_lease_table(false,APS), NewState = send_dhcp_lease_table(false,APS),
message_loop(NewState#ap_state{ check_monitor_tick = NewState#ap_state.check_monitor_tick+1 }); message_loop(NewState#ap_state{ check_monitor_tick = NewState#ap_state.check_monitor_tick+1 });
5 -> 8 ->
?L_IA("~p: Sending DHCP_Leased_IP table.~n",[APS#ap_state.id]), ?L_IA("~p: Sending DHCP_Leased_IP table.~n",[APS#ap_state.id]),
NewState = send_dhcp_lease_table(true,APS), NewState = send_dhcp_lease_table(true,APS),
message_loop(NewState#ap_state{ check_monitor_tick = NewState#ap_state.check_monitor_tick+1 }); message_loop(NewState#ap_state{ check_monitor_tick = NewState#ap_state.check_monitor_tick+1 });
X when (X>500) -> X when ( X > 500 ) ->
message_loop(APS#ap_state{ check_monitor_tick = 1 }); message_loop(APS#ap_state{ check_monitor_tick = 1 });
_ -> _ ->
message_loop(APS#ap_state{ check_monitor_tick = APS#ap_state.check_monitor_tick+1 }) message_loop(APS#ap_state{ check_monitor_tick = APS#ap_state.check_monitor_tick+1 })
@@ -289,8 +289,8 @@ stop_timer(T) -> _=timer:cancel(T).
-spec start_timers(APS::ap_state()) -> NewAPS::ap_state(). -spec start_timers(APS::ap_state()) -> NewAPS::ap_state().
start_timers(APS)-> start_timers(APS)->
{ok, MqttUpdateTimer} = timer:send_interval(20000,check_mqtt_updates), {ok, MqttUpdateTimer} = timer:send_interval(30000,check_mqtt_updates),
{ok, CheckPublishMonitor } = timer:send_interval(10000,check_publish_monitor), {ok, CheckPublishMonitor } = timer:send_interval(20000,check_publish_monitor),
APS#ap_state{ mqtt_update_timer = MqttUpdateTimer, publish_timer = CheckPublishMonitor}. APS#ap_state{ mqtt_update_timer = MqttUpdateTimer, publish_timer = CheckPublishMonitor}.
-spec stop_timers(APS::ap_state()) -> NewAPS::ap_state(). -spec stop_timers(APS::ap_state()) -> NewAPS::ap_state().