tweaks and lt sync
This commit is contained in:
parent
4156788296
commit
eeb2c26002
|
@ -41,6 +41,7 @@ TORRENT_EXPORT void assert_fail(const char* expr, int line, char const* file, ch
|
||||||
#define TORRENT_ASSERT(x) if (x) {} else assert_fail(#x, __LINE__, __FILE__, __PRETTY_FUNCTION__)
|
#define TORRENT_ASSERT(x) if (x) {} else assert_fail(#x, __LINE__, __FILE__, __PRETTY_FUNCTION__)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
#include <cassert>
|
||||||
#define TORRENT_ASSERT(x) assert(x)
|
#define TORRENT_ASSERT(x) assert(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -379,6 +379,7 @@ namespace libtorrent
|
||||||
// this pool is used to allocate and recycle send
|
// this pool is used to allocate and recycle send
|
||||||
// buffers from.
|
// buffers from.
|
||||||
boost::pool<> m_send_buffers;
|
boost::pool<> m_send_buffers;
|
||||||
|
boost::mutex m_send_buffer_mutex;
|
||||||
|
|
||||||
// the file pool that all storages in this session's
|
// the file pool that all storages in this session's
|
||||||
// torrents uses. It sets a limit on the number of
|
// torrents uses. It sets a limit on the number of
|
||||||
|
|
|
@ -2391,7 +2391,11 @@ namespace detail
|
||||||
|
|
||||||
std::pair<char*, int> session_impl::allocate_buffer(int size)
|
std::pair<char*, int> session_impl::allocate_buffer(int size)
|
||||||
{
|
{
|
||||||
|
TORRENT_ASSERT(size > 0);
|
||||||
int num_buffers = (size + send_buffer_size - 1) / send_buffer_size;
|
int num_buffers = (size + send_buffer_size - 1) / send_buffer_size;
|
||||||
|
TORRENT_ASSERT(num_buffers > 0);
|
||||||
|
|
||||||
|
boost::mutex::scoped_lock l(m_send_buffer_mutex);
|
||||||
#ifdef TORRENT_STATS
|
#ifdef TORRENT_STATS
|
||||||
m_buffer_allocations += num_buffers;
|
m_buffer_allocations += num_buffers;
|
||||||
m_buffer_usage_logger << log_time() << " protocol_buffer: "
|
m_buffer_usage_logger << log_time() << " protocol_buffer: "
|
||||||
|
@ -2403,8 +2407,12 @@ namespace detail
|
||||||
|
|
||||||
void session_impl::free_buffer(char* buf, int size)
|
void session_impl::free_buffer(char* buf, int size)
|
||||||
{
|
{
|
||||||
|
TORRENT_ASSERT(size > 0);
|
||||||
TORRENT_ASSERT(size % send_buffer_size == 0);
|
TORRENT_ASSERT(size % send_buffer_size == 0);
|
||||||
int num_buffers = size / send_buffer_size;
|
int num_buffers = size / send_buffer_size;
|
||||||
|
TORRENT_ASSERT(num_buffers > 0);
|
||||||
|
|
||||||
|
boost::mutex::scoped_lock l(m_send_buffer_mutex);
|
||||||
#ifdef TORRENT_STATS
|
#ifdef TORRENT_STATS
|
||||||
m_buffer_allocations -= num_buffers;
|
m_buffer_allocations -= num_buffers;
|
||||||
TORRENT_ASSERT(m_buffer_allocations >= 0);
|
TORRENT_ASSERT(m_buffer_allocations >= 0);
|
||||||
|
|
|
@ -2147,6 +2147,11 @@ namespace libtorrent
|
||||||
throw protocol_error("session is closing");
|
throw protocol_error("session is closing");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (int(m_connections.size()) >= m_max_connections)
|
||||||
|
{
|
||||||
|
throw protocol_error("reached connection limit");
|
||||||
|
}
|
||||||
|
|
||||||
TORRENT_ASSERT(m_connections.find(p) == m_connections.end());
|
TORRENT_ASSERT(m_connections.find(p) == m_connections.end());
|
||||||
peer_iterator ci = m_connections.insert(p).first;
|
peer_iterator ci = m_connections.insert(p).first;
|
||||||
try
|
try
|
||||||
|
|
|
@ -877,7 +877,6 @@ Space:") + " " + nice_free)
|
||||||
del self.state.torrents[torrent]
|
del self.state.torrents[torrent]
|
||||||
continue
|
continue
|
||||||
if torrent not in self.unique_IDs.values():
|
if torrent not in self.unique_IDs.values():
|
||||||
# print "Adding torrent to core:", torrent.filename, torrent.save_dir, torrent.compact
|
|
||||||
try:
|
try:
|
||||||
unique_ID = deluge_core.add_torrent(torrent.filename,
|
unique_ID = deluge_core.add_torrent(torrent.filename,
|
||||||
torrent.save_dir,
|
torrent.save_dir,
|
||||||
|
|
|
@ -746,7 +746,7 @@ window, please enter your password"))
|
||||||
def double_click_folder(self, tree, path, view_column):
|
def double_click_folder(self, tree, path, view_column):
|
||||||
self.open_folder(view_column)
|
self.open_folder(view_column)
|
||||||
|
|
||||||
def open_folder(self, widget):
|
def open_folder(self, widget, uids=None):
|
||||||
if not common.windows_check():
|
if not common.windows_check():
|
||||||
if self.config.get("open_folder_stock"):
|
if self.config.get("open_folder_stock"):
|
||||||
if self.config.get("file_manager") == common.FileManager.xdg:
|
if self.config.get("file_manager") == common.FileManager.xdg:
|
||||||
|
@ -763,8 +763,11 @@ window, please enter your password"))
|
||||||
else:
|
else:
|
||||||
file_manager = "explorer.exe"
|
file_manager = "explorer.exe"
|
||||||
|
|
||||||
|
if not uids:
|
||||||
|
unique_ids = self.get_selected_torrent_rows()
|
||||||
|
else:
|
||||||
|
unique_ids = uids
|
||||||
|
|
||||||
unique_ids = self.get_selected_torrent_rows()
|
|
||||||
try:
|
try:
|
||||||
for uid in unique_ids:
|
for uid in unique_ids:
|
||||||
torrent_path = self.manager.get_torrent_path(uid)
|
torrent_path = self.manager.get_torrent_path(uid)
|
||||||
|
|
Loading…
Reference in New Issue