Skip to content

Commit

Permalink
Avoid calling mg_send on no actual payload
Browse files Browse the repository at this point in the history
  • Loading branch information
scaprile committed Dec 29, 2023
1 parent 744df7b commit 2427c40
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion mongoose.c
Original file line number Diff line number Diff line change
Expand Up @@ -3990,7 +3990,7 @@ void mg_mqtt_pub(struct mg_connection *c, const struct mg_mqtt_opts *opts) {

if (c->is_mqtt5) mg_send_mqtt_properties(c, opts->props, opts->num_props);

mg_send(c, opts->message.ptr, opts->message.len);
if (opts->message.len > 0) mg_send(c, opts->message.ptr, opts->message.len);
}

void mg_mqtt_sub(struct mg_connection *c, const struct mg_mqtt_opts *opts) {
Expand Down
2 changes: 1 addition & 1 deletion src/mqtt.c
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ void mg_mqtt_pub(struct mg_connection *c, const struct mg_mqtt_opts *opts) {

if (c->is_mqtt5) mg_send_mqtt_properties(c, opts->props, opts->num_props);

mg_send(c, opts->message.ptr, opts->message.len);
if (opts->message.len > 0) mg_send(c, opts->message.ptr, opts->message.len);
}

void mg_mqtt_sub(struct mg_connection *c, const struct mg_mqtt_opts *opts) {
Expand Down

0 comments on commit 2427c40

Please sign in to comment.