mirror of https://github.com/eclipse/paho.mqtt.c
Fix: Use thread-safe MQTTAsync_Socket_noPendingWrites in MQTTAsync pending writes handling
Signed-off-by: x152152 <604047286@qq.com>
This commit is contained in:
parent
04b7199798
commit
092e2c4682
|
|
@ -1027,7 +1027,7 @@ static void MQTTProtocol_checkPendingWrites(void)
|
|||
ListElement* le = state.pending_writes.first;
|
||||
while (le)
|
||||
{
|
||||
if (Socket_noPendingWrites(((pending_write*)(le->content))->socket))
|
||||
if (MQTTAsync_Socket_noPendingWrites(((pending_write*)(le->content))->socket))
|
||||
{
|
||||
MQTTProtocol_removePublication(((pending_write*)(le->content))->p);
|
||||
state.pending_writes.current = le;
|
||||
|
|
@ -2462,7 +2462,7 @@ static void MQTTAsync_closeOnly(Clients* client, enum MQTTReasonCodes reasonCode
|
|||
if (client->net.socket > 0)
|
||||
{
|
||||
MQTTProtocol_checkPendingWrites();
|
||||
if (client->connected && Socket_noPendingWrites(client->net.socket))
|
||||
if (client->connected && MQTTAsync_Socket_noPendingWrites(client->net.socket))
|
||||
MQTTPacket_send_disconnect(client, reasonCode, props);
|
||||
MQTTAsync_lock_mutex(socket_mutex);
|
||||
WebSocket_close(&client->net, WebSocket_CLOSE_NORMAL, NULL);
|
||||
|
|
|
|||
Loading…
Reference in New Issue