[link] actually disable timeout if -ac_timeout is <= 0

See #820
This commit is contained in:
Felix Ruess
2015-04-28 17:52:07 +02:00
parent a0bee87ba8
commit 25d975e59c
+3 -3
View File
@@ -74,7 +74,7 @@ let ping_msg_period = ref 5000 (** ms *)
(* Time (in ms) after which an aircraft is regarded as dead/off if no messages are received.
If an aircraft is not live anymore, no uplink messages are sent.
Set to a negative number to disable this feature.
Set to a zero (or negative number) to disable this feature.
*)
let dead_aircraft_time_ms = ref 5000
@@ -141,7 +141,7 @@ let status_ping_diff = 500 (* ms *)
let live_aircraft = fun ac_id ->
try
let s = Hashtbl.find statuss ac_id in
s.ms_since_last_msg < !dead_aircraft_time_ms
!dead_aircraft_time_ms <= 0 || s.ms_since_last_msg < !dead_aircraft_time_ms
with
Not_found -> false
@@ -492,7 +492,7 @@ let () =
"-id", Arg.Set_int link_id, (sprintf "<id> Sets the link id. If multiple links are used, each must have a unique id. Default is %i" !link_id);
"-status_period", Arg.Set_int status_msg_period, (sprintf "<period> Sets the period (in ms) of the LINK_REPORT status message. Default is %i" !status_msg_period);
"-ping_period", Arg.Set_int ping_msg_period, (sprintf "<period> Sets the period (in ms) of the PING message sent to aircrafs. Default is %i" !ping_msg_period);
"-ac_timeout", Arg.Set_int dead_aircraft_time_ms, (sprintf "<time> Sets the time (in ms) after which an aircraft is regarded as dead/off if no messages are received. Default is %i, set to negative to disable." !ping_msg_period)
"-ac_timeout", Arg.Set_int dead_aircraft_time_ms, (sprintf "<time> Sets the time (in ms) after which an aircraft is regarded as dead/off if no messages are received. Default is %ims, set to zero to disable." !ping_msg_period)
] in
Arg.parse options (fun _x -> ()) "Usage: ";