mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-08 11:12:31 +00:00
HttpQueue finishing touches.
git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@266 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+9
-14
@@ -3,6 +3,7 @@
|
||||
#include <memory>
|
||||
#include <sstream>
|
||||
#include <sigc++/bind.h>
|
||||
#include <sigc++/hide.h>
|
||||
#include <torrent/http.h>
|
||||
|
||||
#include "functional.h"
|
||||
@@ -11,29 +12,31 @@
|
||||
|
||||
namespace core {
|
||||
|
||||
void
|
||||
HttpQueue::iterator
|
||||
HttpQueue::insert(const std::string& url) {
|
||||
std::auto_ptr<torrent::Http> h(m_slotFactory());
|
||||
std::auto_ptr<std::stringstream> s(new std::stringstream);
|
||||
|
||||
h->set_out(s.get());
|
||||
h->set_url(url);
|
||||
h->set_stream(s.get());
|
||||
h->set_user_agent("rtorrent/" VERSION);
|
||||
|
||||
iterator itr = Base::insert(end(), h.get());
|
||||
|
||||
h->slot_done(sigc::bind(sigc::mem_fun(this, &HttpQueue::receive_done), itr));
|
||||
h->slot_failed(sigc::bind<0>(sigc::mem_fun(this, &HttpQueue::receive_failed), itr));
|
||||
h->signal_done().connect(sigc::bind(sigc::mem_fun(this, &HttpQueue::erase), itr));
|
||||
h->signal_failed().connect(sigc::bind<0>(sigc::hide(sigc::mem_fun(this, &HttpQueue::erase)), itr));
|
||||
|
||||
(*itr)->start();
|
||||
|
||||
h.release();
|
||||
s.release();
|
||||
|
||||
return itr;
|
||||
}
|
||||
|
||||
void
|
||||
HttpQueue::erase(iterator itr) {
|
||||
delete (*itr)->get_out();
|
||||
delete (*itr)->get_stream();
|
||||
delete *itr;
|
||||
|
||||
Base::erase(itr);
|
||||
@@ -41,18 +44,10 @@ HttpQueue::erase(iterator itr) {
|
||||
|
||||
void
|
||||
HttpQueue::clear() {
|
||||
std::for_each(begin(), end(), func::on(func::call_delete(), std::mem_fun(&CurlGet::get_out)));
|
||||
std::for_each(begin(), end(), func::on(func::call_delete(), std::mem_fun(&CurlGet::get_stream)));
|
||||
std::for_each(begin(), end(), func::call_delete());
|
||||
|
||||
Base::clear();
|
||||
}
|
||||
|
||||
void
|
||||
HttpQueue::receive_done(iterator itr) {
|
||||
}
|
||||
|
||||
void
|
||||
HttpQueue::receive_failed(iterator itr, std::string msg) {
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user