kopia lustrzana https://github.com/martin-ger/uMQTTBroker
handling of '$' topics
rodzic
d54abcb23e
commit
560ccfa374
|
@ -455,6 +455,11 @@ static void ICACHE_FLASH_ATTR MQTT_ClientCon_recv_cb(void *arg, char *pdata, uns
|
|||
MQTT_server_disconnectClientCon(clientcon);
|
||||
return;
|
||||
}
|
||||
if (clientcon->connect_info.will_topic[0] == '$') {
|
||||
MQTT_WARNING("MQTT: Last Will topic starts with '$'\r\n");
|
||||
MQTT_server_disconnectClientCon(clientcon);
|
||||
return;
|
||||
}
|
||||
MQTT_INFO("MQTT: LWT topic %s\r\n", clientcon->connect_info.will_topic);
|
||||
} else {
|
||||
MQTT_ERROR("MQTT: Out of mem\r\n");
|
||||
|
@ -699,6 +704,11 @@ static void ICACHE_FLASH_ATTR MQTT_ClientCon_recv_cb(void *arg, char *pdata, uns
|
|||
data_len = clientcon->mqtt_state.in_buffer_length;
|
||||
data = (uint8_t *) mqtt_get_publish_data(clientcon->mqtt_state.in_buffer, &data_len);
|
||||
|
||||
if (topic_buffer[0] == '$') {
|
||||
MQTT_WARNING("MQTT: Topic starts with '$'\r\n");
|
||||
break;
|
||||
}
|
||||
|
||||
MQTT_INFO("MQTT: Published topic \"%s\"\r\n", topic_buffer);
|
||||
MQTT_INFO("MQTT: Matches to:\r\n");
|
||||
|
||||
|
|
|
@ -146,12 +146,16 @@ int ICACHE_FLASH_ATTR Topics_matches(char *wildTopic, int wildcards, char *topic
|
|||
goto exit;
|
||||
}
|
||||
|
||||
if (strcmp(wildTopic, MULTI_LEVEL_WILDCARD) == 0 || /* Hash matches anything... */
|
||||
strcmp(wildTopic, topic) == 0) {
|
||||
if (strcmp(wildTopic, topic) == 0) {
|
||||
rc = true;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (strcmp(wildTopic, MULTI_LEVEL_WILDCARD) == 0) { /* Hash matches anything, but starting with '$'... */
|
||||
rc = (topic[0] == '$') ? false : true;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if (strcmp(wildTopic, "/#") == 0) { /* Special case for /# matches anything starting with / */
|
||||
rc = (topic[0] == '/') ? true : false;
|
||||
goto exit;
|
||||
|
|
Ładowanie…
Reference in New Issue