Uninitializing SSL on mg_stop()

This commit is contained in:
valenok committed 2011-06-22 08:35:08 +01:00
1 parent 8942a4cdad
commit a77519def3
1 file changed
+16
+16
View File
@@ -3647,6 +3647,18 @@ static int set_ssl_option(struct mg_context *ctx) {
return 1;
}
static void uninitialize_ssl(struct mg_context *ctx) {
int i;
if (ctx->ssl_ctx != NULL) {
CRYPTO_set_locking_callback(NULL);
for (i = 0; i < CRYPTO_num_locks(); i++) {
pthread_mutex_destroy(&ssl_mutexes[i]);
}
CRYPTO_set_locking_callback(NULL);
CRYPTO_set_id_callback(NULL);
}
}
#endif // !NO_SSL
static int set_gpass_option(struct mg_context *ctx) {
@@ -4026,6 +4038,10 @@ static void master_thread(struct mg_context *ctx) {
(void) pthread_cond_destroy(&ctx->sq_empty);
(void) pthread_cond_destroy(&ctx->sq_full);
#if !defined(NO_SSL)
uninitialize_ssl(ctx);
#endif
// Signal mg_stop() that we're done
ctx->stop_flag = 2;