Keep-alive rejection
// When keep_alive feature is disabled client can live forever, which is not good in
// distributed broker context so currenlty we don't allow it.
if connect.keep_alive == 0 {
return Err(Error::ZeroKeepAlive);
}
Such behaviour deviates from the 3.1.1 specification:
A Keep Alive value of zero (0) has the effect of turning off the keep alive mechanism. This means that, in this case, the Server is not required to disconnect the Client on the grounds of inactivity. Note that a Server is permitted to disconnect a Client that it determines to be inactive or non-responsive at any time, regardless of the Keep Alive value provided by that Client.
The server may enforce it's own keep-alive when zero, yet it may not deny clients that wish to abstain from PING obligations.
The handle_auth routine before ignores the keep-alive value. How about a sane default of 30 seconds or something like that?
@pascaldekloe instead of rejecting clients with keep_alive 0 , we can handle clients with 0 keep_alive by enforcing a default value (probably little higher) to lower its bandwidth utilization. for V5 clients we can return server_keep_alive in connack packet