mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-12 05:02:31 +00:00
* Fixed various memory leaks/errors.
* Don't increment beyond end when incrementing a entry's completed counter. * Don't allow ChokeManager::try_unchoke to succeed when it has been less than 10 seconds since the last unchoke. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@562 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -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"
|
||||
@@ -51,7 +51,7 @@ CurlGet::CurlGet(CurlStack* s) :
|
||||
m_stack(s) {
|
||||
|
||||
if (m_stack == NULL)
|
||||
throw torrent::client_error("Tried to create CurlGet without a valid CurlStack");
|
||||
throw std::logic_error("Tried to create CurlGet without a valid CurlStack");
|
||||
}
|
||||
|
||||
CurlGet::~CurlGet() {
|
||||
@@ -66,10 +66,10 @@ CurlGet::new_object(CurlStack* s) {
|
||||
void
|
||||
CurlGet::start() {
|
||||
if (is_busy())
|
||||
throw torrent::internal_error("Tried to call CurlGet::start on a busy object");
|
||||
throw std::logic_error("Tried to call CurlGet::start on a busy object");
|
||||
|
||||
if (m_stream == NULL)
|
||||
throw torrent::internal_error("Tried to call CurlGet::start without a valid output stream");
|
||||
throw std::logic_error("Tried to call CurlGet::start without a valid output stream");
|
||||
|
||||
m_handle = curl_easy_init();
|
||||
|
||||
@@ -117,7 +117,7 @@ CurlGet::get_size_total() {
|
||||
void
|
||||
CurlGet::perform(CURLMsg* msg) {
|
||||
if (msg->msg != CURLMSG_DONE)
|
||||
throw torrent::client_error("CurlGet::process got CURLMSG that isn't done");
|
||||
throw std::logic_error("CurlGet::process got CURLMSG that isn't done");
|
||||
|
||||
if (msg->data.result == CURLE_OK)
|
||||
m_signalDone.emit();
|
||||
|
||||
@@ -106,7 +106,7 @@ CurlStack::add_get(CurlGet* get) {
|
||||
CURLMcode code;
|
||||
|
||||
if ((code = curl_multi_add_handle((CURLM*)m_handle, get->handle())) > 0)
|
||||
throw torrent::local_error("curl_multi_add_handle \"" + std::string(curl_multi_strerror(code)));
|
||||
throw std::logic_error("curl_multi_add_handle \"" + std::string(curl_multi_strerror(code)));
|
||||
|
||||
m_size++;
|
||||
m_getList.push_back(get);
|
||||
@@ -118,12 +118,12 @@ CurlStack::add_get(CurlGet* get) {
|
||||
void
|
||||
CurlStack::remove_get(CurlGet* get) {
|
||||
if (curl_multi_remove_handle((CURLM*)m_handle, get->handle()) > 0)
|
||||
throw torrent::local_error("Error calling curl_multi_remove_handle");
|
||||
throw std::logic_error("Error calling curl_multi_remove_handle");
|
||||
|
||||
CurlGetList::iterator itr = std::find(m_getList.begin(), m_getList.end(), get);
|
||||
|
||||
if (itr == m_getList.end())
|
||||
throw torrent::client_error("Could not find CurlGet when calling CurlStack::remove");
|
||||
throw std::logic_error("Could not find CurlGet when calling CurlStack::remove");
|
||||
|
||||
m_size--;
|
||||
m_getList.erase(itr);
|
||||
|
||||
@@ -79,9 +79,16 @@ PollManager::PollManager(torrent::Poll* poll) :
|
||||
|
||||
PollManager::~PollManager() {
|
||||
delete m_poll;
|
||||
|
||||
#if defined USE_VARIABLE_FDSET
|
||||
delete [] m_readSet;
|
||||
delete [] m_writeSet;
|
||||
delete [] m_errorSet;
|
||||
#else
|
||||
delete m_readSet;
|
||||
delete m_writeSet;
|
||||
delete m_errorSet;
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -47,6 +47,7 @@
|
||||
#include <sigc++/retype_return.h>
|
||||
#include <torrent/http.h>
|
||||
#include <torrent/torrent.h>
|
||||
#include <torrent/exceptions.h>
|
||||
#include <rak/functional.h>
|
||||
|
||||
#ifdef USE_EXECINFO
|
||||
@@ -240,6 +241,12 @@ main(int argc, char** argv) {
|
||||
|
||||
uiControl.cleanup();
|
||||
|
||||
} catch (torrent::base_error& e) {
|
||||
display::Canvas::cleanup();
|
||||
|
||||
std::cout << "Caught exception from libtorrent: \"" << e.what() << '"' << std::endl;
|
||||
return -1;
|
||||
|
||||
} catch (std::exception& e) {
|
||||
display::Canvas::cleanup();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user