Merge pull request from tuanpmt/master

Update code from upstream
develop
Rui Huang 2016-04-20 16:54:01 +08:00
commit 679c42a062
1 zmienionych plików z 6 dodań i 5 usunięć
mqtt

Wyświetl plik

@ -604,7 +604,7 @@ MQTT_Task(os_event_t *e)
case TCP_RECONNECT_DISCONNECTING:
if (client->security) {
#ifdef MQTT_SSL_ENABLE
espconn_secure_connect(client->pCon);
espconn_secure_disconnect(client->pCon);
#else
INFO("TCP: Do not support SSL\r\n");
#endif
@ -751,10 +751,11 @@ MQTT_InitLWT(MQTT_Client *mqttClient, uint8_t* will_topic, uint8_t* will_msg, ui
void ICACHE_FLASH_ATTR
MQTT_Connect(MQTT_Client *mqttClient)
{
// Do not connect if this client is already connected otherwise the
// two espconn connections may interfere causing unexpected behaviour.
if (mqttClient->pCon) {
return;
// Clean up the old connection forcefully - using MQTT_Disconnect
// does not actually release the old connection until the
// disconnection callback is invoked.
mqtt_tcpclient_delete(mqttClient);
}
mqttClient->pCon = (struct espconn *)os_zalloc(sizeof(struct espconn));
mqttClient->pCon->type = ESPCONN_TCP;
@ -840,4 +841,4 @@ void ICACHE_FLASH_ATTR
MQTT_OnTimeout(MQTT_Client *mqttClient, MqttCallback timeoutCb)
{
mqttClient->timeoutCb = timeoutCb;
}
}