mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-12 21:22:31 +00:00
Converted curl/http to be thread-safe.
This commit is contained in:
@@ -8,13 +8,13 @@
|
||||
namespace core {
|
||||
|
||||
HttpQueue::iterator
|
||||
HttpQueue::insert(const std::string& url, std::iostream* s) {
|
||||
auto itr = base_type::insert(end(), torrent::net_thread::http_stack()->create(url, s));
|
||||
HttpQueue::insert(const std::string& url, std::iostream* stream) {
|
||||
auto itr = base_type::insert(end(), torrent::net::HttpGet(url, stream));
|
||||
|
||||
itr->add_done_slot([this, itr]() { erase(itr); });
|
||||
itr->add_failed_slot([this, itr](auto) { erase(itr); });
|
||||
|
||||
itr->start();
|
||||
torrent::net_thread::http_stack()->start_get(*itr);
|
||||
|
||||
for (auto& slot : m_signal_insert)
|
||||
slot(*itr);
|
||||
|
||||
@@ -38,7 +38,7 @@ public:
|
||||
//
|
||||
// Consider adding a flag to indicate whetever HttpQueue should
|
||||
// delete the stream.
|
||||
iterator insert(const std::string& url, std::iostream* s);
|
||||
iterator insert(const std::string& url, std::iostream* stream);
|
||||
void erase(iterator itr);
|
||||
|
||||
void clear();
|
||||
|
||||
@@ -126,7 +126,7 @@ WindowHttpQueue::receive_erase(torrent::net::HttpGet http_get) {
|
||||
if (itr == m_container.end())
|
||||
throw std::logic_error("WindowHttpQueue::receive_erase(...) tried to remove an object we don't have");
|
||||
|
||||
itr->m_http = nullptr;
|
||||
itr->m_http = torrent::net::HttpGet();
|
||||
itr->m_timer = torrent::this_thread::cached_time() + 4s;
|
||||
|
||||
mark_dirty();
|
||||
|
||||
Reference in New Issue
Block a user