Fix: Use thread-safe MQTTAsync_Socket_noPendingWrites in MQTTAsync pending writes handling

Signed-off-by: x152152 <604047286@qq.com>
This commit is contained in:
x152152 2025-11-21 20:17:25 +08:00 committed by Ian Craggs
parent 04b7199798
commit 092e2c4682
No known key found for this signature in database
GPG Key ID: A7AE1A8F2CCAB186
1 changed files with 2 additions and 2 deletions

View File

@ -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);