mirror of
https://github.com/cesanta/mongoose.git
synced 2026-11-10 16:31:44 +00:00
cleanup 'str' API
This commit is contained in:
1 parent
6c7672f4af
commit
3c531897b6
20 files changed
+350
-400
No files matched your search
+2
-3
@@ -254,14 +254,13 @@ size_t mg_mqtt_next_prop(struct mg_mqtt_message *msg, struct mg_mqtt_prop *prop,
|
||||
}
|
||||
|
||||
void mg_mqtt_login(struct mg_connection *c, const struct mg_mqtt_opts *opts) {
|
||||
char rnd[10], client_id[21];
|
||||
char client_id[21];
|
||||
struct mg_str cid = opts->client_id;
|
||||
size_t total_len = 7 + 1 + 2 + 2;
|
||||
uint8_t hdr[8] = {0, 4, 'M', 'Q', 'T', 'T', opts->version, 0};
|
||||
|
||||
if (cid.len == 0) {
|
||||
mg_random(rnd, sizeof(rnd));
|
||||
mg_hex(rnd, sizeof(rnd), client_id);
|
||||
mg_random_str(client_id, sizeof(client_id) - 1);
|
||||
client_id[sizeof(client_id) - 1] = '\0';
|
||||
cid = mg_str(client_id);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user