Compare commits
2 Commits
master
...
deluge-0.5
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b25b51e998 | ||
|
|
0a909908d9 |
10
ChangeLog
10
ChangeLog
@ -1,6 +1,14 @@
|
|||||||
Deluge 0.5.7 (xx November 2007)
|
Deluge 0.5.6.2 (31 October 2007)
|
||||||
* Set default piece size to 256-KiB in TorrentCreator plugin and add 2048KiB
|
* Set default piece size to 256-KiB in TorrentCreator plugin and add 2048KiB
|
||||||
as a size option.
|
as a size option.
|
||||||
|
* Fix a bug in Debian package that caused the UI to completely freeze when a
|
||||||
|
torrent finished
|
||||||
|
* Find and fix another shutdown bug that mostly Gutsy users were incountering
|
||||||
|
* Fix a couple of WebUI bugs, including the "index" page erroring out
|
||||||
|
|
||||||
|
Deluge 0.5.6.1 (28 October 2007)
|
||||||
|
* Fix invalid handle error
|
||||||
|
* Fix shutdown hang
|
||||||
|
|
||||||
Deluge 0.5.6 (24 October 2007)
|
Deluge 0.5.6 (24 October 2007)
|
||||||
* Web Interface Plugin
|
* Web Interface Plugin
|
||||||
|
|||||||
@ -375,6 +375,12 @@ namespace libtorrent
|
|||||||
// buffers from.
|
// buffers from.
|
||||||
boost::pool<> m_send_buffers;
|
boost::pool<> m_send_buffers;
|
||||||
|
|
||||||
|
// this is where all active sockets are stored.
|
||||||
|
// the selector can sleep while there's no activity on
|
||||||
|
// them
|
||||||
|
io_service m_io_service;
|
||||||
|
asio::strand m_strand;
|
||||||
|
|
||||||
// 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
|
||||||
// open files by this session.
|
// open files by this session.
|
||||||
@ -389,12 +395,6 @@ namespace libtorrent
|
|||||||
// object.
|
// object.
|
||||||
disk_io_thread m_disk_thread;
|
disk_io_thread m_disk_thread;
|
||||||
|
|
||||||
// this is where all active sockets are stored.
|
|
||||||
// the selector can sleep while there's no activity on
|
|
||||||
// them
|
|
||||||
io_service m_io_service;
|
|
||||||
asio::strand m_strand;
|
|
||||||
|
|
||||||
// this is a list of half-open tcp connections
|
// this is a list of half-open tcp connections
|
||||||
// (only outgoing connections)
|
// (only outgoing connections)
|
||||||
// this has to be one of the last
|
// this has to be one of the last
|
||||||
@ -646,7 +646,7 @@ namespace libtorrent
|
|||||||
|
|
||||||
void debug_log(const std::string& line)
|
void debug_log(const std::string& line)
|
||||||
{
|
{
|
||||||
(*m_ses.m_logger) << time_now_string() << " " << line << "\n";
|
(*m_ses.m_logger) << line << "\n";
|
||||||
}
|
}
|
||||||
session_impl& m_ses;
|
session_impl& m_ses;
|
||||||
};
|
};
|
||||||
|
|||||||
@ -56,7 +56,6 @@ public:
|
|||||||
void done(int ticket);
|
void done(int ticket);
|
||||||
void limit(int limit);
|
void limit(int limit);
|
||||||
int limit() const;
|
int limit() const;
|
||||||
void close();
|
|
||||||
|
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
|
||||||
|
|||||||
@ -130,8 +130,6 @@ namespace libtorrent
|
|||||||
, proxy_settings const& ps
|
, proxy_settings const& ps
|
||||||
, std::string const& password = "");
|
, std::string const& password = "");
|
||||||
|
|
||||||
void close();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
boost::intrusive_ptr<http_tracker_connection> self()
|
boost::intrusive_ptr<http_tracker_connection> self()
|
||||||
|
|||||||
@ -34,6 +34,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#define TORRENT_INTRUSIVE_PTR_BASE
|
#define TORRENT_INTRUSIVE_PTR_BASE
|
||||||
|
|
||||||
#include <boost/detail/atomic_count.hpp>
|
#include <boost/detail/atomic_count.hpp>
|
||||||
|
#include <boost/checked_delete.hpp>
|
||||||
#include "libtorrent/config.hpp"
|
#include "libtorrent/config.hpp"
|
||||||
#include "libtorrent/assert.hpp"
|
#include "libtorrent/assert.hpp"
|
||||||
|
|
||||||
@ -60,7 +61,7 @@ namespace libtorrent
|
|||||||
TORRENT_ASSERT(s->m_refs > 0);
|
TORRENT_ASSERT(s->m_refs > 0);
|
||||||
TORRENT_ASSERT(s != 0);
|
TORRENT_ASSERT(s != 0);
|
||||||
if (--s->m_refs == 0)
|
if (--s->m_refs == 0)
|
||||||
delete static_cast<T const*>(s);
|
boost::checked_delete(static_cast<T const*>(s));
|
||||||
}
|
}
|
||||||
|
|
||||||
boost::intrusive_ptr<T> self()
|
boost::intrusive_ptr<T> self()
|
||||||
|
|||||||
@ -57,6 +57,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "libtorrent/peer_request.hpp"
|
#include "libtorrent/peer_request.hpp"
|
||||||
#include "libtorrent/hasher.hpp"
|
#include "libtorrent/hasher.hpp"
|
||||||
#include "libtorrent/config.hpp"
|
#include "libtorrent/config.hpp"
|
||||||
|
#include "libtorrent/buffer.hpp"
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
@ -344,8 +345,8 @@ namespace libtorrent
|
|||||||
// used to move pieces while expanding
|
// used to move pieces while expanding
|
||||||
// the storage from compact allocation
|
// the storage from compact allocation
|
||||||
// to full allocation
|
// to full allocation
|
||||||
std::vector<char> m_scratch_buffer;
|
buffer m_scratch_buffer;
|
||||||
std::vector<char> m_scratch_buffer2;
|
buffer m_scratch_buffer2;
|
||||||
// the piece that is in the scratch buffer
|
// the piece that is in the scratch buffer
|
||||||
int m_scratch_piece;
|
int m_scratch_piece;
|
||||||
|
|
||||||
|
|||||||
@ -202,7 +202,7 @@ namespace libtorrent
|
|||||||
|
|
||||||
void fail(int code, char const* msg);
|
void fail(int code, char const* msg);
|
||||||
void fail_timeout();
|
void fail_timeout();
|
||||||
virtual void close();
|
void close();
|
||||||
address const& bind_interface() const { return m_bind_interface; }
|
address const& bind_interface() const { return m_bind_interface; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|||||||
@ -74,8 +74,6 @@ namespace libtorrent
|
|||||||
, boost::weak_ptr<request_callback> c
|
, boost::weak_ptr<request_callback> c
|
||||||
, session_settings const& stn);
|
, session_settings const& stn);
|
||||||
|
|
||||||
void close();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
enum action_t
|
enum action_t
|
||||||
|
|||||||
@ -190,6 +190,8 @@ namespace libtorrent
|
|||||||
|
|
||||||
void broadcast_socket::close()
|
void broadcast_socket::close()
|
||||||
{
|
{
|
||||||
|
m_on_receive.clear();
|
||||||
|
|
||||||
for (std::list<socket_entry>::iterator i = m_sockets.begin()
|
for (std::list<socket_entry>::iterator i = m_sockets.begin()
|
||||||
, end(m_sockets.end()); i != end; ++i)
|
, end(m_sockets.end()); i != end; ++i)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -86,11 +86,6 @@ namespace libtorrent
|
|||||||
try_connect();
|
try_connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
void connection_queue::close()
|
|
||||||
{
|
|
||||||
m_timer.cancel();
|
|
||||||
}
|
|
||||||
|
|
||||||
void connection_queue::limit(int limit)
|
void connection_queue::limit(int limit)
|
||||||
{ m_half_open_limit = limit; }
|
{ m_half_open_limit = limit; }
|
||||||
|
|
||||||
|
|||||||
@ -489,9 +489,7 @@ namespace libtorrent
|
|||||||
, boost::lexical_cast<std::string>(m_port));
|
, boost::lexical_cast<std::string>(m_port));
|
||||||
m_name_lookup.async_resolve(q, m_strand.wrap(
|
m_name_lookup.async_resolve(q, m_strand.wrap(
|
||||||
boost::bind(&http_tracker_connection::name_lookup, self(), _1, _2)));
|
boost::bind(&http_tracker_connection::name_lookup, self(), _1, _2)));
|
||||||
set_timeout(req.event == tracker_request::stopped
|
set_timeout(m_settings.tracker_completion_timeout
|
||||||
? m_settings.stop_tracker_timeout
|
|
||||||
: m_settings.tracker_completion_timeout
|
|
||||||
, m_settings.tracker_receive_timeout);
|
, m_settings.tracker_receive_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -505,17 +503,6 @@ namespace libtorrent
|
|||||||
fail_timeout();
|
fail_timeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void http_tracker_connection::close()
|
|
||||||
{
|
|
||||||
asio::error_code ec;
|
|
||||||
m_socket.close(ec);
|
|
||||||
m_name_lookup.cancel();
|
|
||||||
if (m_connection_ticket > -1) m_cc.done(m_connection_ticket);
|
|
||||||
m_connection_ticket = -1;
|
|
||||||
m_timed_out = true;
|
|
||||||
tracker_connection::close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void http_tracker_connection::name_lookup(asio::error_code const& error
|
void http_tracker_connection::name_lookup(asio::error_code const& error
|
||||||
, tcp::resolver::iterator i) try
|
, tcp::resolver::iterator i) try
|
||||||
{
|
{
|
||||||
@ -772,6 +759,7 @@ namespace libtorrent
|
|||||||
if (m_parser.status_code() != 200)
|
if (m_parser.status_code() != 200)
|
||||||
{
|
{
|
||||||
fail(m_parser.status_code(), m_parser.message().c_str());
|
fail(m_parser.status_code(), m_parser.message().c_str());
|
||||||
|
close();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -833,7 +821,6 @@ namespace libtorrent
|
|||||||
TORRENT_ASSERT(false);
|
TORRENT_ASSERT(false);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
close();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
peer_entry http_tracker_connection::extract_peer_info(const entry& info)
|
peer_entry http_tracker_connection::extract_peer_info(const entry& info)
|
||||||
|
|||||||
@ -547,8 +547,8 @@ namespace detail
|
|||||||
, fingerprint const& cl_fprint
|
, fingerprint const& cl_fprint
|
||||||
, char const* listen_interface)
|
, char const* listen_interface)
|
||||||
: m_send_buffers(send_buffer_size)
|
: m_send_buffers(send_buffer_size)
|
||||||
, m_files(40)
|
|
||||||
, m_strand(m_io_service)
|
, m_strand(m_io_service)
|
||||||
|
, m_files(40)
|
||||||
, m_half_open(m_io_service)
|
, m_half_open(m_io_service)
|
||||||
, m_download_channel(m_io_service, peer_connection::download_channel)
|
, m_download_channel(m_io_service, peer_connection::download_channel)
|
||||||
, m_upload_channel(m_io_service, peer_connection::upload_channel)
|
, m_upload_channel(m_io_service, peer_connection::upload_channel)
|
||||||
@ -675,17 +675,6 @@ namespace detail
|
|||||||
if (m_dht) m_dht->stop();
|
if (m_dht) m_dht->stop();
|
||||||
#endif
|
#endif
|
||||||
m_timer.cancel();
|
m_timer.cancel();
|
||||||
|
|
||||||
// close the listen sockets
|
|
||||||
for (std::list<listen_socket_t>::iterator i = m_listen_sockets.begin()
|
|
||||||
, end(m_listen_sockets.end()); i != end; ++i)
|
|
||||||
{
|
|
||||||
i->sock->close();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
|
||||||
(*m_logger) << time_now_string() << " aborting all torrents\n";
|
|
||||||
#endif
|
|
||||||
// abort all torrents
|
// abort all torrents
|
||||||
for (torrent_map::iterator i = m_torrents.begin()
|
for (torrent_map::iterator i = m_torrents.begin()
|
||||||
, end(m_torrents.end()); i != end; ++i)
|
, end(m_torrents.end()); i != end; ++i)
|
||||||
@ -693,25 +682,7 @@ namespace detail
|
|||||||
i->second->abort();
|
i->second->abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
m_io_service.stop();
|
||||||
(*m_logger) << time_now_string() << " aborting all connections\n";
|
|
||||||
#endif
|
|
||||||
// abort all connections
|
|
||||||
for (connection_map::iterator i = m_connections.begin()
|
|
||||||
, end(m_connections.end()); i != end; ++i)
|
|
||||||
{
|
|
||||||
i->second->disconnect();
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
|
||||||
(*m_logger) << time_now_string() << " aborting all tracker requests\n";
|
|
||||||
#endif
|
|
||||||
m_tracker_manager.abort_all_requests();
|
|
||||||
|
|
||||||
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
|
||||||
(*m_logger) << time_now_string() << " shutting down connection queue\n";
|
|
||||||
#endif
|
|
||||||
m_half_open.close();
|
|
||||||
|
|
||||||
mutex::scoped_lock l2(m_checker_impl.m_mutex);
|
mutex::scoped_lock l2(m_checker_impl.m_mutex);
|
||||||
// abort the checker thread
|
// abort the checker thread
|
||||||
@ -1003,16 +974,16 @@ namespace detail
|
|||||||
m_alerts.post_alert(peer_blocked_alert(endp.address()
|
m_alerts.post_alert(peer_blocked_alert(endp.address()
|
||||||
, "incoming connection blocked by IP filter"));
|
, "incoming connection blocked by IP filter"));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// don't allow more connections than the max setting
|
// don't allow more connections than the max setting
|
||||||
if (m_connections.size() > max_connections())
|
if (m_connections.size() > max_connections())
|
||||||
{
|
{
|
||||||
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
||||||
(*m_logger) << "number of connections limit exceeded (conns: "
|
(*m_logger) << "number of connections limit exceeded (conns: "
|
||||||
<< num_connections() << ", limit: " << max_connections()
|
<< num_connections() << ", limit: " << max_connections()
|
||||||
<< "), connection rejected\n";
|
<< "), connection rejected\n";
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -1514,12 +1485,20 @@ namespace detail
|
|||||||
while (!m_abort);
|
while (!m_abort);
|
||||||
|
|
||||||
deadline_timer tracker_timer(m_io_service);
|
deadline_timer tracker_timer(m_io_service);
|
||||||
|
// this will remove the port mappings
|
||||||
|
if (m_natpmp.get())
|
||||||
|
m_natpmp->close();
|
||||||
|
if (m_upnp.get())
|
||||||
|
m_upnp->close();
|
||||||
|
|
||||||
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
||||||
(*m_logger) << time_now_string() << " locking mutex\n";
|
(*m_logger) << time_now_string() << " locking mutex\n";
|
||||||
#endif
|
#endif
|
||||||
session_impl::mutex_t::scoped_lock l(m_mutex);
|
session_impl::mutex_t::scoped_lock l(m_mutex);
|
||||||
|
|
||||||
|
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
||||||
|
(*m_logger) << time_now_string() << " aborting all tracker requests\n";
|
||||||
|
#endif
|
||||||
m_tracker_manager.abort_all_requests();
|
m_tracker_manager.abort_all_requests();
|
||||||
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
||||||
(*m_logger) << time_now_string() << " sending stopped to all torrent's trackers\n";
|
(*m_logger) << time_now_string() << " sending stopped to all torrent's trackers\n";
|
||||||
@ -2159,10 +2138,16 @@ namespace detail
|
|||||||
|
|
||||||
session_impl::~session_impl()
|
session_impl::~session_impl()
|
||||||
{
|
{
|
||||||
|
abort();
|
||||||
|
|
||||||
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
||||||
(*m_logger) << time_now_string() << "\n\n *** shutting down session *** \n\n";
|
(*m_logger) << time_now_string() << "\n\n *** shutting down session *** \n\n";
|
||||||
#endif
|
#endif
|
||||||
abort();
|
// lock the main thread and abort it
|
||||||
|
mutex_t::scoped_lock l(m_mutex);
|
||||||
|
m_abort = true;
|
||||||
|
m_io_service.stop();
|
||||||
|
l.unlock();
|
||||||
|
|
||||||
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
||||||
(*m_logger) << time_now_string() << " waiting for main thread\n";
|
(*m_logger) << time_now_string() << " waiting for main thread\n";
|
||||||
|
|||||||
@ -99,6 +99,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include <windows.h>
|
#include <windows.h>
|
||||||
#include <boost/filesystem/exception.hpp>
|
#include <boost/filesystem/exception.hpp>
|
||||||
#include "libtorrent/utf8.hpp"
|
#include "libtorrent/utf8.hpp"
|
||||||
|
#include "libtorrent/buffer.hpp"
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
@ -386,7 +387,7 @@ namespace libtorrent
|
|||||||
file_pool& m_files;
|
file_pool& m_files;
|
||||||
|
|
||||||
// temporary storage for moving pieces
|
// temporary storage for moving pieces
|
||||||
std::vector<char> m_scratch_buffer;
|
buffer m_scratch_buffer;
|
||||||
};
|
};
|
||||||
|
|
||||||
sha1_hash storage::hash_for_slot(int slot, partial_hash& ph, int piece_size)
|
sha1_hash storage::hash_for_slot(int slot, partial_hash& ph, int piece_size)
|
||||||
@ -468,14 +469,14 @@ namespace libtorrent
|
|||||||
void storage::release_files()
|
void storage::release_files()
|
||||||
{
|
{
|
||||||
m_files.release(this);
|
m_files.release(this);
|
||||||
std::vector<char>().swap(m_scratch_buffer);
|
buffer().swap(m_scratch_buffer);
|
||||||
}
|
}
|
||||||
|
|
||||||
void storage::delete_files()
|
void storage::delete_files()
|
||||||
{
|
{
|
||||||
// make sure we don't have the files open
|
// make sure we don't have the files open
|
||||||
m_files.release(this);
|
m_files.release(this);
|
||||||
std::vector<char>().swap(m_scratch_buffer);
|
buffer().swap(m_scratch_buffer);
|
||||||
|
|
||||||
// delete the files from disk
|
// delete the files from disk
|
||||||
std::set<std::string> directories;
|
std::set<std::string> directories;
|
||||||
@ -975,6 +976,7 @@ namespace libtorrent
|
|||||||
, m_storage_mode(storage_mode_sparse)
|
, m_storage_mode(storage_mode_sparse)
|
||||||
, m_info(ti)
|
, m_info(ti)
|
||||||
, m_save_path(complete(save_path))
|
, m_save_path(complete(save_path))
|
||||||
|
, m_state(state_none)
|
||||||
, m_current_slot(0)
|
, m_current_slot(0)
|
||||||
, m_out_of_place(false)
|
, m_out_of_place(false)
|
||||||
, m_scratch_piece(-1)
|
, m_scratch_piece(-1)
|
||||||
@ -1622,8 +1624,8 @@ namespace libtorrent
|
|||||||
if (m_current_slot == m_info->num_pieces())
|
if (m_current_slot == m_info->num_pieces())
|
||||||
{
|
{
|
||||||
m_state = state_create_files;
|
m_state = state_create_files;
|
||||||
std::vector<char>().swap(m_scratch_buffer);
|
buffer().swap(m_scratch_buffer);
|
||||||
std::vector<char>().swap(m_scratch_buffer2);
|
buffer().swap(m_scratch_buffer2);
|
||||||
if (m_storage_mode != storage_mode_compact)
|
if (m_storage_mode != storage_mode_compact)
|
||||||
{
|
{
|
||||||
std::vector<int>().swap(m_piece_to_slot);
|
std::vector<int>().swap(m_piece_to_slot);
|
||||||
|
|||||||
@ -3055,7 +3055,7 @@ namespace libtorrent
|
|||||||
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
||||||
void torrent::debug_log(const std::string& line)
|
void torrent::debug_log(const std::string& line)
|
||||||
{
|
{
|
||||||
(*m_ses.m_logger) << time_now_string() << " " << line << "\n";
|
(*m_ses.m_logger) << line << "\n";
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@ -302,12 +302,12 @@ namespace libtorrent
|
|||||||
{
|
{
|
||||||
m_completion_timeout = completion_timeout;
|
m_completion_timeout = completion_timeout;
|
||||||
m_read_timeout = read_timeout;
|
m_read_timeout = read_timeout;
|
||||||
m_start_time = m_read_time = time_now();
|
m_start_time = time_now();
|
||||||
|
m_read_time = time_now();
|
||||||
|
|
||||||
m_timeout.expires_at((std::min)(
|
m_timeout.expires_at((std::min)(
|
||||||
m_read_time + seconds(m_read_timeout)
|
m_read_time + seconds(m_read_timeout)
|
||||||
, m_start_time + seconds((std::min)(m_completion_timeout
|
, m_start_time + seconds(m_completion_timeout)));
|
||||||
, m_read_timeout))));
|
|
||||||
m_timeout.async_wait(m_strand.wrap(bind(
|
m_timeout.async_wait(m_strand.wrap(bind(
|
||||||
&timeout_handler::timeout_callback, self(), _1)));
|
&timeout_handler::timeout_callback, self(), _1)));
|
||||||
}
|
}
|
||||||
@ -343,8 +343,7 @@ namespace libtorrent
|
|||||||
|
|
||||||
m_timeout.expires_at((std::min)(
|
m_timeout.expires_at((std::min)(
|
||||||
m_read_time + seconds(m_read_timeout)
|
m_read_time + seconds(m_read_timeout)
|
||||||
, m_start_time + seconds((std::min)(m_completion_timeout
|
, m_start_time + seconds(m_completion_timeout)));
|
||||||
, m_read_timeout))));
|
|
||||||
m_timeout.async_wait(m_strand.wrap(
|
m_timeout.async_wait(m_strand.wrap(
|
||||||
bind(&timeout_handler::timeout_callback, self(), _1)));
|
bind(&timeout_handler::timeout_callback, self(), _1)));
|
||||||
}
|
}
|
||||||
@ -568,24 +567,24 @@ namespace libtorrent
|
|||||||
m_abort = true;
|
m_abort = true;
|
||||||
tracker_connections_t keep_connections;
|
tracker_connections_t keep_connections;
|
||||||
|
|
||||||
while (!m_connections.empty())
|
while (!m_connections.empty())
|
||||||
{
|
{
|
||||||
boost::intrusive_ptr<tracker_connection>& c = m_connections.back();
|
boost::intrusive_ptr<tracker_connection>& c = m_connections.back();
|
||||||
if (!c)
|
if (!c)
|
||||||
{
|
{
|
||||||
m_connections.pop_back();
|
m_connections.pop_back();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
tracker_request const& req = c->tracker_req();
|
tracker_request const& req = c->tracker_req();
|
||||||
if (req.event == tracker_request::stopped)
|
if (req.event == tracker_request::stopped)
|
||||||
{
|
{
|
||||||
keep_connections.push_back(c);
|
keep_connections.push_back(c);
|
||||||
m_connections.pop_back();
|
m_connections.pop_back();
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// close will remove the entry from m_connections
|
// close will remove the entry from m_connections
|
||||||
// so no need to pop
|
// so no need to pop
|
||||||
c->close();
|
c->close();
|
||||||
}
|
}
|
||||||
|
|
||||||
std::swap(m_connections, keep_connections);
|
std::swap(m_connections, keep_connections);
|
||||||
|
|||||||
@ -96,9 +96,7 @@ namespace libtorrent
|
|||||||
m_name_lookup.async_resolve(q
|
m_name_lookup.async_resolve(q
|
||||||
, m_strand.wrap(boost::bind(
|
, m_strand.wrap(boost::bind(
|
||||||
&udp_tracker_connection::name_lookup, self(), _1, _2)));
|
&udp_tracker_connection::name_lookup, self(), _1, _2)));
|
||||||
set_timeout(req.event == tracker_request::stopped
|
set_timeout(m_settings.tracker_completion_timeout
|
||||||
? m_settings.stop_tracker_timeout
|
|
||||||
: m_settings.tracker_completion_timeout
|
|
||||||
, m_settings.tracker_receive_timeout);
|
, m_settings.tracker_receive_timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -158,20 +156,11 @@ namespace libtorrent
|
|||||||
|
|
||||||
void udp_tracker_connection::on_timeout()
|
void udp_tracker_connection::on_timeout()
|
||||||
{
|
{
|
||||||
asio::error_code ec;
|
m_socket.close();
|
||||||
m_socket.close(ec);
|
|
||||||
m_name_lookup.cancel();
|
m_name_lookup.cancel();
|
||||||
fail_timeout();
|
fail_timeout();
|
||||||
}
|
}
|
||||||
|
|
||||||
void udp_tracker_connection::close()
|
|
||||||
{
|
|
||||||
asio::error_code ec;
|
|
||||||
m_socket.close(ec);
|
|
||||||
m_name_lookup.cancel();
|
|
||||||
tracker_connection::close();
|
|
||||||
}
|
|
||||||
|
|
||||||
void udp_tracker_connection::send_udp_connect()
|
void udp_tracker_connection::send_udp_connect()
|
||||||
{
|
{
|
||||||
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
#if defined(TORRENT_VERBOSE_LOGGING) || defined(TORRENT_LOGGING)
|
||||||
@ -479,7 +468,6 @@ namespace libtorrent
|
|||||||
, complete, incomplete);
|
, complete, incomplete);
|
||||||
|
|
||||||
m_man.remove_request(this);
|
m_man.remove_request(this);
|
||||||
close();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
@ -555,7 +543,6 @@ namespace libtorrent
|
|||||||
if (!cb)
|
if (!cb)
|
||||||
{
|
{
|
||||||
m_man.remove_request(this);
|
m_man.remove_request(this);
|
||||||
close();
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -564,7 +551,6 @@ namespace libtorrent
|
|||||||
, complete, incomplete);
|
, complete, incomplete);
|
||||||
|
|
||||||
m_man.remove_request(this);
|
m_man.remove_request(this);
|
||||||
close();
|
|
||||||
}
|
}
|
||||||
catch (std::exception& e)
|
catch (std::exception& e)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -97,19 +97,22 @@ class TorrentNotification:
|
|||||||
|
|
||||||
def show_notification(self, event):
|
def show_notification(self, event):
|
||||||
if not deluge.common.windows_check():
|
if not deluge.common.windows_check():
|
||||||
import pynotify
|
try:
|
||||||
file_info = self.interface.manager.get_torrent_file_info(event['unique_ID'])
|
import pynotify
|
||||||
filelist = ""
|
except:
|
||||||
for file in file_info[:10]:
|
pass
|
||||||
filelist += file['path'] + "\n"
|
else:
|
||||||
if len(file_info) > 10:
|
file_info = self.interface.manager.get_torrent_file_info(event['unique_ID'])
|
||||||
filelist += '...'
|
filelist = ""
|
||||||
|
for file in file_info[:10]:
|
||||||
if pynotify.init("Deluge"):
|
filelist += file['path'] + "\n"
|
||||||
n = pynotify.Notification(_("Torrent complete"),
|
if len(file_info) > 10:
|
||||||
_("Files") + ":\n" + filelist)
|
filelist += '...'
|
||||||
n.set_icon_from_pixbuf(deluge.common.get_logo(48))
|
if pynotify.init("Deluge"):
|
||||||
n.show()
|
n = pynotify.Notification(_("Torrent complete"),
|
||||||
|
_("Files") + ":\n" + filelist)
|
||||||
|
n.set_icon_from_pixbuf(deluge.common.get_logo(48))
|
||||||
|
n.show()
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
@ -119,11 +122,14 @@ class TorrentNotification:
|
|||||||
if deluge.common.windows_check():
|
if deluge.common.windows_check():
|
||||||
self.glade.get_widget("chk_notification").set_active(False)
|
self.glade.get_widget("chk_notification").set_active(False)
|
||||||
self.glade.get_widget("chk_notification").set_sensitive(False)
|
self.glade.get_widget("chk_notification").set_sensitive(False)
|
||||||
|
self.glade.get_widget("chk_sound").set_active(False)
|
||||||
|
self.glade.get_widget("chk_sound").set_sensitive(False)
|
||||||
|
self.glade.get_widget("sound_path_button").set_sensitive(False)
|
||||||
else:
|
else:
|
||||||
self.glade.get_widget("chk_notification").set_active(self.config.get("enable_notification"))
|
self.glade.get_widget("chk_notification").set_active(self.config.get("enable_notification"))
|
||||||
self.glade.get_widget("chk_sound").set_active(self.config.get("enable_sound"))
|
self.glade.get_widget("chk_sound").set_active(self.config.get("enable_sound"))
|
||||||
self.glade.get_widget("sound_path_button").set_sensitive(self.config.get("enable_sound"))
|
self.glade.get_widget("sound_path_button").set_sensitive(self.config.get("enable_sound"))
|
||||||
self.glade.get_widget("sound_path_button").set_filename(self.config.get("sound_path"))
|
self.glade.get_widget("sound_path_button").set_filename(self.config.get("sound_path"))
|
||||||
self.dialog.set_transient_for(window)
|
self.dialog.set_transient_for(window)
|
||||||
self.dialog.show()
|
self.dialog.show()
|
||||||
|
|
||||||
@ -144,19 +150,23 @@ class TorrentNotification:
|
|||||||
|
|
||||||
def play_sound(self):
|
def play_sound(self):
|
||||||
if not deluge.common.windows_check():
|
if not deluge.common.windows_check():
|
||||||
import pygame
|
|
||||||
import os.path
|
|
||||||
import sys
|
|
||||||
pygame.init()
|
|
||||||
try:
|
try:
|
||||||
name = self.config.get("sound_path")
|
import pygame
|
||||||
except:
|
except:
|
||||||
print "no file set"
|
pass
|
||||||
try:
|
else:
|
||||||
alert_sound = pygame.mixer.music
|
import os.path
|
||||||
alert_sound.load(name)
|
import sys
|
||||||
alert_sound.play()
|
pygame.init()
|
||||||
except pygame.error, message:
|
try:
|
||||||
print 'Cannot load sound:'
|
name = self.config.get("sound_path")
|
||||||
|
except:
|
||||||
|
print "no file set"
|
||||||
|
try:
|
||||||
|
alert_sound = pygame.mixer.music
|
||||||
|
alert_sound.load(name)
|
||||||
|
alert_sound.play()
|
||||||
|
except pygame.error, message:
|
||||||
|
print 'Cannot load sound:'
|
||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|||||||
@ -134,7 +134,7 @@ class DbusManager(dbus.service.Object):
|
|||||||
"""same as 0.6 interface"""
|
"""same as 0.6 interface"""
|
||||||
for torrent_id in torrents:
|
for torrent_id in torrents:
|
||||||
torrent_id = int(torrent_id)
|
torrent_id = int(torrent_id)
|
||||||
self.core.set_user_pause(torrent_id,True)
|
self.core.set_user_pause(torrent_id, True)
|
||||||
|
|
||||||
@dbus.service.method(dbus_interface=dbus_interface,
|
@dbus.service.method(dbus_interface=dbus_interface,
|
||||||
in_signature="as", out_signature="")
|
in_signature="as", out_signature="")
|
||||||
@ -142,7 +142,15 @@ class DbusManager(dbus.service.Object):
|
|||||||
"""same as 0.6 interface"""
|
"""same as 0.6 interface"""
|
||||||
for torrent_id in torrents:
|
for torrent_id in torrents:
|
||||||
torrent_id = int(torrent_id)
|
torrent_id = int(torrent_id)
|
||||||
self.core.set_user_pause(torrent_id,False)
|
self.core.set_user_pause(torrent_id, False)
|
||||||
|
|
||||||
|
@dbus.service.method(dbus_interface=dbus_interface,
|
||||||
|
in_signature="as", out_signature="")
|
||||||
|
def force_reannounce(self, torrents):
|
||||||
|
"""same as 0.6 interface"""
|
||||||
|
for torrent_id in torrents:
|
||||||
|
torrent_id = int(torrent_id)
|
||||||
|
self.core.update_tracker(torrent_id)
|
||||||
|
|
||||||
@dbus.service.method(dbus_interface=dbus_interface,
|
@dbus.service.method(dbus_interface=dbus_interface,
|
||||||
in_signature="sbb", out_signature="")
|
in_signature="sbb", out_signature="")
|
||||||
|
|||||||
@ -47,18 +47,19 @@ urls = (
|
|||||||
"/index(.*)", "index",
|
"/index(.*)", "index",
|
||||||
"/torrent/info/(.*)", "torrent_info",
|
"/torrent/info/(.*)", "torrent_info",
|
||||||
"/torrent/pause(.*)", "torrent_pause",
|
"/torrent/pause(.*)", "torrent_pause",
|
||||||
|
"/torrent/reannounce/(.*)", "torrent_reannounce",
|
||||||
"/torrent/add(.*)", "torrent_add",
|
"/torrent/add(.*)", "torrent_add",
|
||||||
"/torrent/delete/(.*)", "torrent_delete",
|
"/torrent/delete/(.*)", "torrent_delete",
|
||||||
"/torrent/queue/up/(.*)", "torrent_queue_up",
|
"/torrent/queue/up/(.*)", "torrent_queue_up",
|
||||||
"/torrent/queue/down/(.*)", "torrent_queue_down",
|
"/torrent/queue/down/(.*)", "torrent_queue_down",
|
||||||
"/pause_all(.*)", "pause_all",
|
"/pause_all", "pause_all",
|
||||||
"/resume_all(.*)", "resume_all",
|
"/resume_all", "resume_all",
|
||||||
"/refresh/set(.*)", "refresh_set",
|
"/refresh/set(.*)", "refresh_set",
|
||||||
"/refresh/(.*)", "refresh",
|
"/refresh/(.*)", "refresh",
|
||||||
"/config(.*)","config",
|
"/config","config",
|
||||||
"/home(.*)", "home",
|
"/home", "home",
|
||||||
"/about(.*)", "about",
|
"/about", "about",
|
||||||
"/logout(.*)", "logout",
|
"/logout", "logout",
|
||||||
#remote-api:
|
#remote-api:
|
||||||
"/remote/torrent/add(.*)", "remote_torrent_add",
|
"/remote/torrent/add(.*)", "remote_torrent_add",
|
||||||
#static:
|
#static:
|
||||||
@ -66,8 +67,8 @@ urls = (
|
|||||||
"/template/static/(.*)","template_static",
|
"/template/static/(.*)","template_static",
|
||||||
#"/downloads/(.*)","downloads" disabled until it can handle large downloads.
|
#"/downloads/(.*)","downloads" disabled until it can handle large downloads.
|
||||||
#default-pages
|
#default-pages
|
||||||
"/(.*)", "home",
|
"/", "home",
|
||||||
"(.*)", "home"
|
"", "home"
|
||||||
)
|
)
|
||||||
#/routing
|
#/routing
|
||||||
|
|
||||||
@ -93,7 +94,7 @@ class login:
|
|||||||
class index:
|
class index:
|
||||||
"page containing the torrent list."
|
"page containing the torrent list."
|
||||||
@deluge_page
|
@deluge_page
|
||||||
@auto_refreshed
|
@auto_refreshed
|
||||||
def GET(self, name):
|
def GET(self, name):
|
||||||
vars = web.input(sort=None, order=None)
|
vars = web.input(sort=None, order=None)
|
||||||
|
|
||||||
@ -113,7 +114,7 @@ class index:
|
|||||||
|
|
||||||
class torrent_info:
|
class torrent_info:
|
||||||
@deluge_page
|
@deluge_page
|
||||||
@auto_refreshed
|
@auto_refreshed
|
||||||
def GET(self, torrent_id):
|
def GET(self, torrent_id):
|
||||||
return ws.render.torrent_info(get_torrent_status(torrent_id))
|
return ws.render.torrent_info(get_torrent_status(torrent_id))
|
||||||
|
|
||||||
@ -125,7 +126,12 @@ class torrent_pause:
|
|||||||
ws.proxy.pause_torrent([vars.stop])
|
ws.proxy.pause_torrent([vars.stop])
|
||||||
elif vars.start:
|
elif vars.start:
|
||||||
ws.proxy.resume_torrent([vars.start])
|
ws.proxy.resume_torrent([vars.start])
|
||||||
|
do_redirect()
|
||||||
|
|
||||||
|
class torrent_reannounce:
|
||||||
|
@check_session
|
||||||
|
def POST(self, torrent_id):
|
||||||
|
ws.proxy.force_reannounce([torrent_id])
|
||||||
do_redirect()
|
do_redirect()
|
||||||
|
|
||||||
class torrent_add:
|
class torrent_add:
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
115
|
117
|
||||||
|
|||||||
@ -56,7 +56,7 @@ $fspeed(torrent.download_rate)</td></td></tr>
|
|||||||
<table>
|
<table>
|
||||||
|
|
||||||
<tr><td class="info_label">$_('Total Size'):</td>
|
<tr><td class="info_label">$_('Total Size'):</td>
|
||||||
<td class="info_value">$fspeed(torrent.total_size)</td></tr>
|
<td class="info_value">$fsize(torrent.total_size)</td></tr>
|
||||||
|
|
||||||
<tr><td class="info_label">$_('# Of Files'):</td>
|
<tr><td class="info_label">$_('# Of Files'):</td>
|
||||||
<td class="info_value">$torrent.num_files</td></tr>
|
<td class="info_value">$torrent.num_files</td></tr>
|
||||||
@ -81,7 +81,7 @@ class="deluge_button">
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
$:render.part_button('GET', '/torrent/delete/' + str(torrent.id), _('Remove'), 'tango/user-trash.png')
|
$:render.part_button('GET', '/torrent/delete/' + str(torrent.id), _('Remove'), 'tango/user-trash.png')
|
||||||
|
$:render.part_button('POST', '/torrent/reannounce/' + str(torrent.id), _('Reannounce'), 'tango/view-refresh.png')
|
||||||
|
|
||||||
<br>
|
<br>
|
||||||
<!--
|
<!--
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
revision-id: mvoncken@gmail.com-20070930083408-sv8mo0mi1rbjnfvk
|
revision-id: mvoncken@gmail.com-20070930083408-sv8mo0mi1rbjnfvk
|
||||||
date: 2007-10-29 15:10:08 +0200
|
date: 2007-10-30 15:10:08 +0200
|
||||||
build-date: 2007-10-29 15:34:50 +0200
|
build-date: 2007-10-30 15:34:50 +0200
|
||||||
revno: 115
|
revno: 117
|
||||||
branch-nick: WebUi
|
branch-nick: WebUi
|
||||||
|
|||||||
@ -84,7 +84,7 @@ def start_session():
|
|||||||
setcookie("session_id", session_id)
|
setcookie("session_id", session_id)
|
||||||
|
|
||||||
def end_session():
|
def end_session():
|
||||||
session_id = getcookie("session_id")
|
session_id = getcookie("session_id")
|
||||||
#if session_id in ws.SESSIONS:
|
#if session_id in ws.SESSIONS:
|
||||||
# ws.SESSIONS.remove(session_id)
|
# ws.SESSIONS.remove(session_id)
|
||||||
#not thread safe! , but a verry rare bug.
|
#not thread safe! , but a verry rare bug.
|
||||||
@ -136,7 +136,7 @@ def check_session(func):
|
|||||||
a decorator
|
a decorator
|
||||||
return func if session is valid, else redirect to login page.
|
return func if session is valid, else redirect to login page.
|
||||||
"""
|
"""
|
||||||
def deco(self, name):
|
def deco(self, name=None):
|
||||||
vars = web.input(redir_after_login=None)
|
vars = web.input(redir_after_login=None)
|
||||||
ck = cookies()
|
ck = cookies()
|
||||||
if ck.has_key("session_id") and ck["session_id"] in ws.SESSIONS:
|
if ck.has_key("session_id") and ck["session_id"] in ws.SESSIONS:
|
||||||
@ -153,7 +153,7 @@ def deluge_page(func):
|
|||||||
#combi-deco's:
|
#combi-deco's:
|
||||||
def auto_refreshed(func):
|
def auto_refreshed(func):
|
||||||
"decorator:adds a refresh header"
|
"decorator:adds a refresh header"
|
||||||
def deco(self, name):
|
def deco(self, name=None):
|
||||||
if getcookie('auto_refresh') == '1':
|
if getcookie('auto_refresh') == '1':
|
||||||
web.header("Refresh", "%i ; url=%s" %
|
web.header("Refresh", "%i ; url=%s" %
|
||||||
(int(getcookie('auto_refresh_secs',10)),self_url()))
|
(int(getcookie('auto_refresh_secs',10)),self_url()))
|
||||||
@ -162,7 +162,7 @@ def auto_refreshed(func):
|
|||||||
|
|
||||||
def remote(func):
|
def remote(func):
|
||||||
"decorator for remote api's"
|
"decorator for remote api's"
|
||||||
def deco(self, name):
|
def deco(self, name=None):
|
||||||
try:
|
try:
|
||||||
print func(self, name)
|
print func(self, name)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
|
|||||||
2
setup.py
2
setup.py
@ -28,7 +28,7 @@
|
|||||||
|
|
||||||
NAME = "deluge"
|
NAME = "deluge"
|
||||||
FULLNAME = "Deluge BitTorrent Client"
|
FULLNAME = "Deluge BitTorrent Client"
|
||||||
VERSION = "0.5.6.15"
|
VERSION = "0.5.6.2"
|
||||||
AUTHOR = "Zach Tibbitts, Alon Zakai, Marcos Pinto, Andrew Resch, Alex Dedul"
|
AUTHOR = "Zach Tibbitts, Alon Zakai, Marcos Pinto, Andrew Resch, Alex Dedul"
|
||||||
EMAIL = "zach@collegegeek.org, kripkensteiner@gmail.com, marcospinto@dipconsultants.com, alonzakai@gmail.com, rotmer@gmail.com"
|
EMAIL = "zach@collegegeek.org, kripkensteiner@gmail.com, marcospinto@dipconsultants.com, alonzakai@gmail.com, rotmer@gmail.com"
|
||||||
DESCRIPTION = "A bittorrent client written in PyGTK"
|
DESCRIPTION = "A bittorrent client written in PyGTK"
|
||||||
|
|||||||
@ -32,7 +32,7 @@ import os
|
|||||||
import xdg.BaseDirectory
|
import xdg.BaseDirectory
|
||||||
|
|
||||||
PROGRAM_NAME = "Deluge"
|
PROGRAM_NAME = "Deluge"
|
||||||
PROGRAM_VERSION = "0.5.6.15"
|
PROGRAM_VERSION = "0.5.6.2"
|
||||||
|
|
||||||
CLIENT_CODE = "DE"
|
CLIENT_CODE = "DE"
|
||||||
CLIENT_VERSION = "".join(PROGRAM_VERSION.split('.'))+"0"*(4 - len(PROGRAM_VERSION.split('.')))
|
CLIENT_VERSION = "".join(PROGRAM_VERSION.split('.'))+"0"*(4 - len(PROGRAM_VERSION.split('.')))
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user