Skip to content

Commit

Permalink
Disconnect clients in case of application shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
ates committed Feb 13, 2011
1 parent 0063ec2 commit cbbfc45
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
5 changes: 4 additions & 1 deletion README.md
Expand Up @@ -14,13 +14,16 @@ Configuration

The following modules should be added to the netspire.conf file:

{mod_iptraffic, [{tariffs, "tariffs.conf"}, {session_timeout, 60}, {delay_stop, 5}]}
{mod_iptraffic, [{tariffs, "tariffs.conf"}, {session_timeout, 60}, {delay_stop, 5}, {disconnect_on_shutdown, yes}]}

The default value of the **session_timeout** option is 60 seconds and may be ommited.

The ***delay_stop*** option is used to delay stopping of the session to receive all data from netflow sensor after the session closing (After receiving Accounting-Stop packet).
The default value of the ***delay_stop*** option is 5 seconds and and may be ommited.

The ***disconnect_on_shutdown*** option is used to specify is need to disconnect clients from NAS in case of application shutdown.
The default value of the ***disconnect_on_shutdown*** option is yes and may be ommited.

You MUST set **Acct-Interim-Interval** RADIUS attribute for client. This attribute is required to prolong session and it's value MUST be significantly less than **session_timeout**.
Note that if Netspire does not receiving interim updates from NAS via RADIUS, sessions will be marked as *expired* and closed, regardless of real state on NAS.

Expand Down
5 changes: 5 additions & 0 deletions src/iptraffic_session.erl
Expand Up @@ -174,6 +174,11 @@ code_change(_OldVsn, State, _Extra) ->
terminate(normal, State) ->
?INFO_MSG("Session ~s finished successfully~n", [to_string(State)]);
terminate(shutdown, State) ->
case gen_module:get_option(mod_iptraffic, disconnect_on_shutdown, yes) of
yes ->
disconnect_client(State);
_ -> ok
end,
stop_session(State, false),
?INFO_MSG("Session ~s shutted down successfully~n", [to_string(State)]);
terminate(Reason, State) ->
Expand Down

0 comments on commit cbbfc45

Please sign in to comment.