Changeset - r28388:0b49553295f0
[Not reviewed]
master
0 1 0
Jonathan G Rennison - 11 months ago 2024-01-04 01:02:51
j.g.rennison@gmail.com
Fix: curl_global_cleanup called before libcurl HTTP thread exited
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general)
src/network/core/http_curl.cpp
Show inline comments
 
@@ -273,14 +273,12 @@ void NetworkHTTPInitialize()
 
	_http_thread_exit = false;
 
	StartNewThread(&_http_thread, "ottd:http", &HttpThread);
 
}
 

	
 
void NetworkHTTPUninitialize()
 
{
 
	curl_global_cleanup();
 

	
 
	_http_thread_exit = true;
 

	
 
	/* Queues must be cleared (and the queue CV signalled) after _http_thread_exit is set to ensure that the HTTP thread can exit */
 
	for (auto &callback : _http_callbacks) {
 
		callback->ClearQueue();
 
	}
 
@@ -290,7 +288,9 @@ void NetworkHTTPUninitialize()
 
		_http_cv.notify_one();
 
	}
 

	
 
	if (_http_thread.joinable()) {
 
		_http_thread.join();
 
	}
 

	
 
	curl_global_cleanup();
 
}
0 comments (0 inline, 0 general)