Skip to content

Commit

Permalink
OpenSSL thread cleanup #1383
Browse files Browse the repository at this point in the history
  • Loading branch information
icraggs committed Oct 5, 2023
1 parent 77d0623 commit d7b8c17
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions src/MQTTAsyncUtils.c
Original file line number Diff line number Diff line change
Expand Up @@ -1819,6 +1819,15 @@ thread_return_type WINAPI MQTTAsync_sendThread(void* n)
sendThread_state = STOPPED;
sendThread_id = 0;
MQTTAsync_unlock_mutex(mqttasync_mutex);

#if defined(OPENSSL)
#if OPENSSL_VERSION_NUMBER < 0x1010000fL
ERR_remove_state(0);
#else
OPENSSL_thread_stop();
#endif
#endif

FUNC_EXIT;
#if defined(_WIN32) || defined(_WIN64)
ExitThread(0);
Expand Down Expand Up @@ -2319,6 +2328,15 @@ thread_return_type WINAPI MQTTAsync_receiveThread(void* n)
if (sendThread_state != STOPPED)
Thread_post_sem(send_sem);
#endif

#if defined(OPENSSL)
#if OPENSSL_VERSION_NUMBER < 0x1010000fL
ERR_remove_state(0);
#else
OPENSSL_thread_stop();
#endif
#endif

FUNC_EXIT;
#if defined(_WIN32) || defined(_WIN64)
ExitThread(0);
Expand Down

0 comments on commit d7b8c17

Please sign in to comment.