mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-09 19:52:31 +00:00
* New throttle implementation, works to a certain degree but still
needs some work. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@588 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+2
-2
@@ -1,4 +1,4 @@
|
||||
AC_INIT(rtorrent, 0.3.6, jaris@ifi.uio.no)
|
||||
AC_INIT(rtorrent, 0.4.0, jaris@ifi.uio.no)
|
||||
|
||||
AM_INIT_AUTOMAKE
|
||||
AM_CONFIG_HEADER(config.h)
|
||||
@@ -22,7 +22,7 @@ TORRENT_OTFD()
|
||||
|
||||
TORRENT_WITHOUT_VARIABLE_FDSET()
|
||||
|
||||
PKG_CHECK_MODULES(STUFF, sigc++-2.0 libtorrent >= 0.7.6,
|
||||
PKG_CHECK_MODULES(STUFF, sigc++-2.0 libtorrent >= 0.8.0,
|
||||
CXXFLAGS="$CXXFLAGS $STUFF_CFLAGS $CURL_CFLAGS";
|
||||
LIBS="$LIBS $STUFF_LIBS $CURL_LIBS")
|
||||
|
||||
|
||||
@@ -46,6 +46,14 @@
|
||||
|
||||
namespace core {
|
||||
|
||||
size_t
|
||||
curl_get_receive_write(void* data, size_t size, size_t nmemb, void* handle) {
|
||||
if (!((CurlGet*)handle)->get_stream()->write((char*)data, size * nmemb).fail())
|
||||
return size * nmemb;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
|
||||
CurlGet::CurlGet(CurlStack* s) :
|
||||
m_handle(NULL),
|
||||
m_stack(s) {
|
||||
@@ -125,9 +133,4 @@ CurlGet::perform(CURLMsg* msg) {
|
||||
m_signalFailed.emit(curl_easy_strerror(msg->data.result));
|
||||
}
|
||||
|
||||
size_t
|
||||
curl_get_receive_write(void* data, size_t size, size_t nmemb, void* handle) {
|
||||
return ((CurlGet*)handle)->m_stream->write((char*)data, size * nmemb).fail() ? 0 : size * nmemb;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -75,8 +75,6 @@ class CurlGet : public torrent::Http {
|
||||
CurlGet(const CurlGet&);
|
||||
void operator = (const CurlGet&);
|
||||
|
||||
friend size_t curl_get_receive_write(void* data, size_t size, size_t nmemb, void* handle);
|
||||
|
||||
CURL* m_handle;
|
||||
|
||||
CurlStack* m_stack;
|
||||
|
||||
+6
-6
@@ -127,14 +127,14 @@ Root::receive_up_throttle(int t) {
|
||||
|
||||
torrent::set_up_throttle(throttle);
|
||||
|
||||
if (throttle == 0)
|
||||
torrent::set_max_unchoked(0);
|
||||
// if (throttle == 0)
|
||||
// torrent::set_max_unchoked(0);
|
||||
|
||||
else if (throttle <= 10 << 10)
|
||||
torrent::set_max_unchoked(1 + throttle / (1 << 10));
|
||||
// else if (throttle <= 10 << 10)
|
||||
// torrent::set_max_unchoked(1 + throttle / (1 << 10));
|
||||
|
||||
else
|
||||
torrent::set_max_unchoked(10 + throttle / (5 << 10));
|
||||
// else
|
||||
// torrent::set_max_unchoked(10 + throttle / (5 << 10));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user