Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Review comment changes for client id get" #5

Merged
merged 1 commit into from
Sep 26, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions src/mqttcm_connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -1694,7 +1694,7 @@ int printList()
int mqtt_subscribe(char *comp, char *topic)
{
int rc;
char temp_topic[30]={'\0'};
char temp_topic[30];
if(topic != NULL && comp !=NULL)
{
int ret = isSubscribeNeeded(comp);
Expand All @@ -1718,18 +1718,9 @@ int mqtt_subscribe(char *comp, char *topic)
if(strcmp (comp, SUBSCRIBE_WEBCONFIG) == 0)
{
int subscribeId;
char *tempclient_id = NULL;
tempclient_id = Get_Mqtt_ClientId();
if( tempclient_id != NULL && strlen(tempclient_id) !=0 )
if( Get_Mqtt_ClientId() != NULL)
{
snprintf(temp_topic, sizeof(temp_topic), "%s%s/#", MQTT_SUBSCRIBE_TOPIC, tempclient_id);
MQTTCM_FREE(tempclient_id);
tempclient_id = NULL;
}
else
{
MqttCMError("Client id is NULL so not proceeding to subscribe\n");
return 1;
snprintf(temp_topic, sizeof(temp_topic), "%s%s/#", MQTT_SUBSCRIBE_TOPIC, Get_Mqtt_ClientId());
}
MqttCMInfo("Subscribing to wildcard topic - %s\n", temp_topic);
rc = mosquitto_subscribe(mosq, &subscribeId, temp_topic, 1);
Expand Down