| 694 | } |
| 695 | |
| 696 | Http::~Http() { |
| 697 | mShuttingDown = true; |
| 698 | |
| 699 | { |
| 700 | Lock l( mCurRequestsMutex ); |
| 701 | for ( auto [_, req] : mCurRequests ) |
| 702 | req->cancel(); |
| 703 | } |
| 704 | |
| 705 | { |
| 706 | Lock l( mThreadsMutex ); |
| 707 | // First we wait to finish any request pending |
| 708 | for ( auto& thread : mThreads ) { |
| 709 | thread->cancel(); |
| 710 | thread->wait(); |
| 711 | eeDelete( thread ); |
| 712 | } |
| 713 | } |
| 714 | |
| 715 | // Then we destroy the last open connection |
| 716 | HttpConnection* connection = mConnection; |
| 717 | |
| 718 | eeSAFE_DELETE( connection ); |
| 719 | } |
| 720 | |
| 721 | void Http::setHost( const std::string& host, unsigned short port, bool useSSL, URI proxy ) { |
| 722 | mProxy = proxy; |