Replaced sigc++ calles for torrent::Http with tr1::bind.

This commit is contained in:
Jari Sundell
2011-11-17 01:06:52 +09:00
parent 00a42357d0
commit 308d91f817
3 changed files with 12 additions and 6 deletions
+6 -2
View File
@@ -46,6 +46,8 @@
#include "curl_socket.h"
#include "curl_stack.h"
namespace std { using namespace tr1; }
namespace core {
CurlStack::CurlStack() :
@@ -131,9 +133,11 @@ CurlStack::transfer_done(void* handle, const char* msg) {
throw torrent::internal_error("Could not find CurlGet with the right easy_handle.");
if (msg == NULL)
(*itr)->signal_done().emit();
std::for_each((*itr)->signal_done().begin(), (*itr)->signal_done().end(),
std::bind(&torrent::Http::slot_void::operator(), std::placeholders::_1));
else
(*itr)->signal_failed().emit(msg);
std::for_each((*itr)->signal_failed().begin(), (*itr)->signal_failed().end(),
std::bind(&torrent::Http::slot_string::operator(), std::placeholders::_1, msg));
}
void
+2 -2
View File
@@ -156,8 +156,8 @@ DownloadFactory::receive_load() {
m_stream = new std::stringstream;
HttpQueue::iterator itr = m_manager->http_queue()->insert(m_uri, m_stream);
(*itr)->signal_done().slots().push_front(sigc::mem_fun(*this, &DownloadFactory::receive_loaded));
(*itr)->signal_failed().slots().push_front(sigc::mem_fun(*this, &DownloadFactory::receive_failed));
(*itr)->signal_done().push_front(std::bind(&DownloadFactory::receive_loaded, this));
(*itr)->signal_failed().push_front(std::bind(&DownloadFactory::receive_failed, this, std::placeholders::_1));
m_variables["tied_to_file"] = (int64_t)false;
+4 -2
View File
@@ -46,6 +46,8 @@
#include "http_queue.h"
#include "curl_get.h"
namespace std { using namespace tr1; }
namespace core {
HttpQueue::iterator
@@ -58,8 +60,8 @@ HttpQueue::insert(const std::string& url, std::iostream* s) {
iterator itr = Base::insert(end(), h.get());
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));
h->signal_done().push_back(std::bind(&HttpQueue::erase, this, itr));
h->signal_failed().push_back(std::bind(&HttpQueue::erase, this, itr));
(*itr)->start();