* Limit the number of simultanious http connections.

* Added max_open_http to the man page.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@840 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2007-01-02 17:06:08 +00:00
parent de744ad11d
commit 3b38c4ab9c
14 changed files with 141 additions and 134 deletions
+3 -44
View File
@@ -37,9 +37,9 @@
#include "config.h"
#include <iostream>
#include <stdexcept>
#include <curl/curl.h>
#include <curl/easy.h>
#include <torrent/exceptions.h>
#include "curl_get.h"
#include "curl_stack.h"
@@ -54,30 +54,17 @@ curl_get_receive_write(void* data, size_t size, size_t nmemb, void* handle) {
return 0;
}
CurlGet::CurlGet(CurlStack* s) :
m_handle(NULL),
m_stack(s) {
if (m_stack == NULL)
throw std::logic_error("Tried to create CurlGet without a valid CurlStack");
}
CurlGet::~CurlGet() {
close();
}
CurlGet*
CurlGet::new_object(CurlStack* s) {
return new CurlGet(s);
}
void
CurlGet::start() {
if (is_busy())
throw std::logic_error("Tried to call CurlGet::start on a busy object");
throw torrent::internal_error("Tried to call CurlGet::start on a busy object.");
if (m_stream == NULL)
throw std::logic_error("Tried to call CurlGet::start without a valid output stream");
throw torrent::internal_error("Tried to call CurlGet::start without a valid output stream.");
m_handle = curl_easy_init();
@@ -127,32 +114,4 @@ CurlGet::size_total() {
return d;
}
void
CurlGet::set_user_agent(const char* s) {
curl_easy_setopt(m_handle, CURLOPT_USERAGENT, s);
}
void
CurlGet::set_http_proxy(const char* s) {
curl_easy_setopt(m_handle, CURLOPT_PROXY, s);
}
void
CurlGet::set_bind_address(const char* s) {
curl_easy_setopt(m_handle, CURLOPT_INTERFACE, s);
}
void
CurlGet::perform(CURLMsg* msg) {
if (msg->msg != CURLMSG_DONE)
throw std::logic_error("CurlGet::process got CURLMSG that isn't done");
if (msg->data.result == CURLE_OK)
m_signalDone.emit();
else
m_signalFailed.emit(curl_easy_strerror(msg->data.result));
// Do nothing below after emitting the signals.
}
}