mirror of
https://github.com/cesanta/mongoose.git
synced 2026-10-13 10:15:00 +00:00
Allow zero-length 'last-will' messages
This commit is contained in:
1 parent
3c3c775213
commit
2ac3552e6e
2 files changed
+2
-2
No files matched your search
+1
-1
@@ -4333,7 +4333,7 @@ void mg_mqtt_login(struct mg_connection *c, const struct mg_mqtt_opts *opts) {
|
||||
total_len += 2 + (uint32_t) opts->pass.len;
|
||||
hdr[7] |= MQTT_HAS_PASSWORD;
|
||||
}
|
||||
if (opts->topic.len > 0 && opts->message.len > 0) {
|
||||
if (opts->topic.len > 0) { // allow zero-length msgs, message.len is size_t
|
||||
total_len += 4 + (uint32_t) opts->topic.len + (uint32_t) opts->message.len;
|
||||
hdr[7] |= MQTT_HAS_WILL;
|
||||
}
|
||||
|
||||
+1
-1
@@ -277,7 +277,7 @@ void mg_mqtt_login(struct mg_connection *c, const struct mg_mqtt_opts *opts) {
|
||||
total_len += 2 + (uint32_t) opts->pass.len;
|
||||
hdr[7] |= MQTT_HAS_PASSWORD;
|
||||
}
|
||||
if (opts->topic.len > 0 && opts->message.len > 0) {
|
||||
if (opts->topic.len > 0) { // allow zero-length msgs, message.len is size_t
|
||||
total_len += 4 + (uint32_t) opts->topic.len + (uint32_t) opts->message.len;
|
||||
hdr[7] |= MQTT_HAS_WILL;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user