Skip to content

Commit

Permalink
Fix inflight max behaviour and option setting.
Browse files Browse the repository at this point in the history
  • Loading branch information
ralight committed Sep 24, 2019
1 parent 096380f commit 4b6cc20
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 9 deletions.
2 changes: 2 additions & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ Broker:

Client library:
- Don't use `/` in autogenerated client ids, to avoid confusing with topics.
- Fix `mosquitto_max_inflight_messages_set()` and `mosquitto_int_option(...,
MOSQ_OPT_*_MAX, ...)` behaviour. Closes #1417.

Clients:
- mosquitto_sub: Fix `-E` incorrectly not working unless `-d` was also
Expand Down
6 changes: 1 addition & 5 deletions lib/messages_mosq.c
Original file line number Diff line number Diff line change
Expand Up @@ -340,10 +340,6 @@ int message__out_update(struct mosquitto *mosq, uint16_t mid, enum mosquitto_msg

int mosquitto_max_inflight_messages_set(struct mosquitto *mosq, unsigned int max_inflight_messages)
{
if(!mosq) return MOSQ_ERR_INVAL;

mosq->send_maximum = max_inflight_messages;

return MOSQ_ERR_SUCCESS;
return mosquitto_int_option(mosq, MOSQ_OPT_SEND_MAXIMUM, max_inflight_messages);
}

2 changes: 0 additions & 2 deletions lib/mosquitto_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -335,8 +335,6 @@ struct mosquitto {
# ifdef WITH_SRV
ares_channel achan;
# endif
uint16_t send_maximum;
uint16_t receive_maximum;
#endif
uint8_t maximum_qos;

Expand Down
12 changes: 10 additions & 2 deletions lib/options.c
Original file line number Diff line number Diff line change
Expand Up @@ -409,14 +409,22 @@ int mosquitto_int_option(struct mosquitto *mosq, enum mosq_opt_t option, int val
if(value < 0 || value > 65535){
return MOSQ_ERR_INVAL;
}
mosq->receive_maximum = value;
if(value == 0){
mosq->msgs_in.inflight_maximum = 65535;
}else{
mosq->msgs_in.inflight_maximum = value;
}
break;

case MOSQ_OPT_SEND_MAXIMUM:
if(value < 0 || value > 65535){
return MOSQ_ERR_INVAL;
}
mosq->send_maximum = value;
if(value == 0){
mosq->msgs_out.inflight_maximum = 65535;
}else{
mosq->msgs_out.inflight_maximum = value;
}
break;

case MOSQ_OPT_SSL_CTX_WITH_DEFAULTS:
Expand Down

0 comments on commit 4b6cc20

Please sign in to comment.