Merge pull request #39 from ucloud/buffix_modify_disconnect_flag
modify disconnect flag
This commit is contained in:
commit
8caa332dad
|
@ -365,8 +365,7 @@ int uiot_mqtt_disconnect(UIoT_Client *pClient) {
|
||||||
HAL_MutexLock(pClient->lock_write_buf);
|
HAL_MutexLock(pClient->lock_write_buf);
|
||||||
ret = serialize_packet_with_zero_payload(pClient->write_buf, pClient->write_buf_size, DISCONNECT, &serialized_len);
|
ret = serialize_packet_with_zero_payload(pClient->write_buf, pClient->write_buf_size, DISCONNECT, &serialized_len);
|
||||||
if (ret != SUCCESS_RET) {
|
if (ret != SUCCESS_RET) {
|
||||||
HAL_MutexUnlock(pClient->lock_write_buf);
|
goto end;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
init_timer(&timer);
|
init_timer(&timer);
|
||||||
|
@ -376,13 +375,13 @@ int uiot_mqtt_disconnect(UIoT_Client *pClient) {
|
||||||
if (serialized_len > 0) {
|
if (serialized_len > 0) {
|
||||||
ret = send_mqtt_packet(pClient, serialized_len, &timer);
|
ret = send_mqtt_packet(pClient, serialized_len, &timer);
|
||||||
if (ret != SUCCESS_RET) {
|
if (ret != SUCCESS_RET) {
|
||||||
HAL_MutexUnlock(pClient->lock_write_buf);
|
goto end;
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
HAL_MutexUnlock(pClient->lock_write_buf);
|
|
||||||
|
|
||||||
// 3. 断开底层TCP连接, 并修改相关标识位
|
// 3. 断开底层TCP连接, 并修改相关标识位
|
||||||
|
end:
|
||||||
|
HAL_MutexUnlock(pClient->lock_write_buf);
|
||||||
pClient->network_stack.disconnect(&(pClient->network_stack));
|
pClient->network_stack.disconnect(&(pClient->network_stack));
|
||||||
set_client_conn_state(pClient, DISCONNECTED);
|
set_client_conn_state(pClient, DISCONNECTED);
|
||||||
pClient->was_manually_disconnected = 1;
|
pClient->was_manually_disconnected = 1;
|
||||||
|
|
Loading…
Reference in New Issue