[329] Fix potential negative timeout being passed to pselect.

Thanks to Dollars.

Bug: https://github.com/eclipse/mosquitto/issues/329
pull/345/head
Roger A. Light 9 years ago
parent b55b47efd3
commit 2c2ba2cf10

@ -6,6 +6,7 @@ Broker:
Client library:
- Clients can now use TLS with IPv6.
- Fix potential socket leakage when reconnecting. Closes #304.
- Fix potential negative timeout being passed to pselect. Closes #329.
1.4.10 - 20160816

@ -916,6 +916,12 @@ int mosquitto_loop(struct mosquitto *mosq, int timeout, int max_packets)
timeout = (mosq->next_msg_out - now)*1000;
}
if(timeout < 0){
/* There has been a delay somewhere which means we should have already
* sent a message. */
timeout = 0;
}
local_timeout.tv_sec = timeout/1000;
#ifdef HAVE_PSELECT
local_timeout.tv_nsec = (timeout-local_timeout.tv_sec*1000)*1e6;

Loading…
Cancel
Save