mirror of
https://github.com/emqx/neuron.git
synced 2026-10-22 17:50:36 +08:00
fix(mqtt): topic is subscribed repeatedly
This commit is contained in:
@@ -803,6 +803,15 @@ neu_err_code_e mqtt_c_client_subscribe(mqtt_c_client_t *client,
|
||||
assert(NULL != client);
|
||||
assert(NULL != topic && 0 < strlen(topic));
|
||||
|
||||
for (struct subscribe_tuple **p =
|
||||
(struct subscribe_tuple **) utarray_front(client->array);
|
||||
NULL != p;
|
||||
p = (struct subscribe_tuple **) utarray_next(client->array, p)) {
|
||||
if (0 == strcmp((*p)->topic, topic)) {
|
||||
return NEU_ERR_SUCCESS;
|
||||
}
|
||||
}
|
||||
|
||||
struct subscribe_tuple *tuple =
|
||||
client_subscribe_create(client, topic, qos, handle);
|
||||
if (NULL == tuple) {
|
||||
|
||||
Reference in New Issue
Block a user