Fix #1434 - set will QoS in CONNECT message correctly, and rename qos -> will_qos in struct mg_mqtt_opts

This commit is contained in:
Sergey Lyubka committed 2021-12-23 11:00:18 +00:00
1 parent f29807aad8
commit 26a97ec36c
8 files changed
+9 -8

No files matched your search

+1 -1
View File
@@ -35,7 +35,7 @@ void mg_mqtt_login(struct mg_connection *c, struct mg_mqtt_opts *opts) {
char rnd[9], client_id[16];
struct mg_str cid = opts->client_id;
uint32_t total_len = 7 + 1 + 2 + 2;
uint8_t connflag = (uint8_t) ((opts->qos & 3) << 1);
uint8_t connflag = (uint8_t) ((opts->will_qos & 3) << 3);
if (cid.len == 0) {
mg_random(rnd, sizeof(rnd));
+1 -1
View File
@@ -24,7 +24,7 @@ struct mg_mqtt_opts {
struct mg_str client_id; // Client ID
struct mg_str will_topic; // Will topic
struct mg_str will_message; // Will message
uint8_t qos; // Quality of service
uint8_t will_qos; // Will message quality of service
bool will_retain; // Retain last will
bool clean; // Use clean session, 0 or 1
uint16_t keepalive; // Keep-alive timer in seconds