Set `receive-maximum` to not exceed the `-C` message count.

This is for mosquitto_sub and mosquitto_rr, to avoid potentially lost
messages.

Closes #2134. Thanks to Frantisek Fuka.
pull/2144/head
Roger Light 5 years ago
parent 9f21a43eee
commit 9faf89be8d

@ -1,3 +1,11 @@
2.0.10 - 2021-xx-xx
==================
Clients:
- Set `receive-maximum` to not exceed the `-C` message count in mosquitto_sub
and mosquitto_rr, to avoid potentially lost messages. Closes #2134.
2.0.9 - 2021-03-11
==================

@ -1321,6 +1321,13 @@ int client_opts_set(struct mosquitto *mosq, struct mosq_config *cfg)
if(cfg->tcp_nodelay){
mosquitto_int_option(mosq, MOSQ_OPT_TCP_NODELAY, 1);
}
if(cfg->msg_count > 0 && cfg->msg_count < 20){
/* 20 is the default "receive maximum"
* If we don't set this, then we can receive > msg_count messages
* before we quit.*/
mosquitto_int_option(mosq, MOSQ_OPT_RECEIVE_MAXIMUM, cfg->msg_count);
}
return MOSQ_ERR_SUCCESS;
}

Loading…
Cancel
Save