mirror of
https://github.com/eclipse/mosquitto.git
synced 2025-05-08 16:52:13 +08:00
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.
This commit is contained in:
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…
x
Reference in New Issue
Block a user