mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-10-13 12:46:18 +00:00
* Some commands were not using the new "log.tracker" name. Ticket #1888.
* Fixed crash on empty bitfield in 'd.bitfield'. * Fixes a file handle leak in the execute_capture functions. Patch by Josef Drexler. * Moved ThreadBase to ./src as ./src/utils caused linker problems due to core::PollManager::create_poll_manager(). git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1102 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
+3
-1
@@ -38,6 +38,8 @@ rtorrent_SOURCES = \
|
|||||||
option_parser.cc \
|
option_parser.cc \
|
||||||
option_parser.h \
|
option_parser.h \
|
||||||
signal_handler.cc \
|
signal_handler.cc \
|
||||||
signal_handler.h
|
signal_handler.h \
|
||||||
|
thread_base.cc \
|
||||||
|
thread_base.h
|
||||||
|
|
||||||
INCLUDES = -I$(srcdir) -I$(top_srcdir)
|
INCLUDES = -I$(srcdir) -I$(top_srcdir)
|
||||||
|
|||||||
@@ -298,6 +298,9 @@ torrent::Object
|
|||||||
retrieve_d_bitfield(core::Download* download) {
|
retrieve_d_bitfield(core::Download* download) {
|
||||||
const torrent::Bitfield* bitField = download->download()->file_list()->bitfield();
|
const torrent::Bitfield* bitField = download->download()->file_list()->bitfield();
|
||||||
|
|
||||||
|
if (bitField->empty())
|
||||||
|
return torrent::Object("");
|
||||||
|
|
||||||
return torrent::Object(rak::transform_hex(bitField->begin(), bitField->end()));
|
return torrent::Object(rak::transform_hex(bitField->begin(), bitField->end()));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -307,7 +310,7 @@ cmd_d_initialize_logs(core::Download* download) {
|
|||||||
download->download()->signal_network_log(sigc::mem_fun(control->core(), &core::Manager::push_log_complete));
|
download->download()->signal_network_log(sigc::mem_fun(control->core(), &core::Manager::push_log_complete));
|
||||||
download->download()->signal_storage_error(sigc::mem_fun(control->core(), &core::Manager::push_log_complete));
|
download->download()->signal_storage_error(sigc::mem_fun(control->core(), &core::Manager::push_log_complete));
|
||||||
|
|
||||||
if (!rpc::call_command_string("get_tracker_dump").empty())
|
if (!rpc::call_command_string("get_log.tracker").empty())
|
||||||
download->download()->signal_tracker_dump(sigc::ptr_fun(&core::receive_tracker_dump));
|
download->download()->signal_tracker_dump(sigc::ptr_fun(&core::receive_tracker_dump));
|
||||||
|
|
||||||
return torrent::Object();
|
return torrent::Object();
|
||||||
|
|||||||
+1
-1
@@ -77,7 +77,7 @@ namespace core {
|
|||||||
|
|
||||||
void
|
void
|
||||||
receive_tracker_dump(const std::string& url, const char* data, size_t size) {
|
receive_tracker_dump(const std::string& url, const char* data, size_t size) {
|
||||||
const std::string& filename = rpc::call_command_string("get_tracker_dump");
|
const std::string& filename = rpc::call_command_string("get_log.tracker");
|
||||||
|
|
||||||
if (filename.empty())
|
if (filename.empty())
|
||||||
return;
|
return;
|
||||||
|
|||||||
+2
-2
@@ -42,5 +42,5 @@ rak::priority_queue_default taskScheduler;
|
|||||||
rak::timer cachedTime;
|
rak::timer cachedTime;
|
||||||
|
|
||||||
Control* control = NULL;
|
Control* control = NULL;
|
||||||
//__thread utils::ThreadBase* this_thread = NULL;
|
//__thread ThreadBase* this_thread = NULL;
|
||||||
utils::ThreadBase* this_thread = NULL;
|
ThreadBase* this_thread = NULL;
|
||||||
|
|||||||
+3
-3
@@ -40,7 +40,7 @@
|
|||||||
#include <rak/timer.h>
|
#include <rak/timer.h>
|
||||||
#include <rak/priority_queue_default.h>
|
#include <rak/priority_queue_default.h>
|
||||||
|
|
||||||
#include "utils/thread_base.h"
|
#include "thread_base.h"
|
||||||
|
|
||||||
class Control;
|
class Control;
|
||||||
|
|
||||||
@@ -53,7 +53,7 @@ extern rak::priority_queue_default taskScheduler;
|
|||||||
extern rak::timer cachedTime;
|
extern rak::timer cachedTime;
|
||||||
|
|
||||||
extern Control* control;
|
extern Control* control;
|
||||||
// extern __thread utils::ThreadBase* this_thread; // Only use for worker threads for now.
|
// extern __thread ThreadBase* this_thread; // Only use for worker threads for now.
|
||||||
extern utils::ThreadBase* this_thread; // Only use for main threads for now.
|
extern ThreadBase* this_thread; // Only use for main threads for now.
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
+1
-1
@@ -154,7 +154,7 @@ main(int argc, char** argv) {
|
|||||||
|
|
||||||
control = new Control;
|
control = new Control;
|
||||||
|
|
||||||
this_thread = new utils::ThreadBase();
|
this_thread = new ThreadBase();
|
||||||
this_thread->init_thread();
|
this_thread->init_thread();
|
||||||
|
|
||||||
srandom(cachedTime.usec());
|
srandom(cachedTime.usec());
|
||||||
|
|||||||
@@ -123,6 +123,8 @@ ExecFile::execute(const char* file, char* const* argv, int flags) {
|
|||||||
m_capture += std::string(buffer, length);
|
m_capture += std::string(buffer, length);
|
||||||
} while (length > 0);
|
} while (length > 0);
|
||||||
|
|
||||||
|
::close(pipeFd[0]);
|
||||||
|
|
||||||
if (m_logFd != -1) {
|
if (m_logFd != -1) {
|
||||||
write(m_logFd, "Captured output:\n", sizeof("Captured output:\n"));
|
write(m_logFd, "Captured output:\n", sizeof("Captured output:\n"));
|
||||||
write(m_logFd, m_capture.data(), m_capture.length());
|
write(m_logFd, m_capture.data(), m_capture.length());
|
||||||
|
|||||||
@@ -43,8 +43,6 @@
|
|||||||
|
|
||||||
#include "globals.h"
|
#include "globals.h"
|
||||||
|
|
||||||
namespace utils {
|
|
||||||
|
|
||||||
// Temporarly injected into config.h.
|
// Temporarly injected into config.h.
|
||||||
/* temp hack */
|
/* temp hack */
|
||||||
//#define __cacheline_aligned __attribute__((__aligned__(128)))
|
//#define __cacheline_aligned __attribute__((__aligned__(128)))
|
||||||
@@ -155,5 +153,3 @@ ThreadBase::init_thread() {
|
|||||||
// ThreadBase::queue_item(thread_base_func newFunc) {
|
// ThreadBase::queue_item(thread_base_func newFunc) {
|
||||||
// m_threadQueue->push_back(newFunc);
|
// m_threadQueue->push_back(newFunc);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
}
|
|
||||||
@@ -41,8 +41,6 @@
|
|||||||
#include "rak/priority_queue_default.h"
|
#include "rak/priority_queue_default.h"
|
||||||
#include "core/poll_manager.h"
|
#include "core/poll_manager.h"
|
||||||
|
|
||||||
namespace utils {
|
|
||||||
|
|
||||||
struct thread_queue_hack;
|
struct thread_queue_hack;
|
||||||
|
|
||||||
// Move this class to libtorrent.
|
// Move this class to libtorrent.
|
||||||
@@ -82,6 +80,4 @@ private:
|
|||||||
// thread_queue_hack* m_threadQueue;
|
// thread_queue_hack* m_threadQueue;
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
@@ -9,8 +9,6 @@ libsub_utils_a_SOURCES = \
|
|||||||
lockfile.cc \
|
lockfile.cc \
|
||||||
lockfile.h \
|
lockfile.h \
|
||||||
socket_fd.cc \
|
socket_fd.cc \
|
||||||
socket_fd.h \
|
socket_fd.h
|
||||||
thread_base.cc \
|
|
||||||
thread_base.h
|
|
||||||
|
|
||||||
INCLUDES = -I$(srcdir) -I$(srcdir)/.. -I$(top_srcdir)
|
INCLUDES = -I$(srcdir) -I$(srcdir)/.. -I$(top_srcdir)
|
||||||
|
|||||||
Reference in New Issue
Block a user