mirror of
https://github.com/codex-storage/deluge.git
synced 2025-01-12 12:34:43 +00:00
ppc fix and libtorrent updates
This commit is contained in:
parent
c6202e1986
commit
21b9e10aed
@ -40,11 +40,26 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||
#include "libtorrent/config.hpp"
|
||||
#include "zlib.h"
|
||||
|
||||
#ifdef TORRENT_USE_OPENSSL
|
||||
extern "C"
|
||||
{
|
||||
#include "openssl/sha.h"
|
||||
#include "openssl/bn.h"
|
||||
#include <openssl/sha.h>
|
||||
}
|
||||
#else
|
||||
// from sha1.cpp
|
||||
struct TORRENT_EXPORT SHA_CTX
|
||||
{
|
||||
boost::uint32_t state[5];
|
||||
boost::uint32_t count[2];
|
||||
boost::uint8_t buffer[64];
|
||||
};
|
||||
|
||||
TORRENT_EXPORT void SHA1_Init(SHA_CTX* context);
|
||||
TORRENT_EXPORT void SHA1_Update(SHA_CTX* context, boost::uint8_t const* data, boost::uint32_t len);
|
||||
TORRENT_EXPORT void SHA1_Final(boost::uint8_t* digest, SHA_CTX* context);
|
||||
|
||||
#endif
|
||||
|
||||
namespace libtorrent
|
||||
{
|
||||
|
||||
|
@ -1,9 +1,15 @@
|
||||
#ifndef TORRENT_HTTP_STREAM_HPP_INCLUDED
|
||||
#define TORRENT_HTTP_STREAM_HPP_INCLUDED
|
||||
#include "libtorrent/proxy_base.hpp"
|
||||
#include "libtorrent/io.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <asio/read.hpp>
|
||||
#include <asio/write.hpp>
|
||||
|
||||
|
||||
namespace libtorrent {
|
||||
class http_stream : public proxy_base
|
||||
|
||||
class http_stream : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
|
||||
@ -12,12 +18,19 @@ public:
|
||||
typedef stream_socket::protocol_type protocol_type;
|
||||
|
||||
explicit http_stream(asio::io_service& io_service)
|
||||
: proxy_base(io_service)
|
||||
: m_sock(io_service)
|
||||
, m_resolver(io_service)
|
||||
, m_no_connect(false)
|
||||
{}
|
||||
|
||||
void set_no_connect(bool c) { m_no_connect = c; }
|
||||
|
||||
void set_proxy(std::string hostname, int port)
|
||||
{
|
||||
m_hostname = hostname;
|
||||
m_port = port;
|
||||
}
|
||||
|
||||
void set_username(std::string const& user
|
||||
, std::string const& password)
|
||||
{
|
||||
@ -25,6 +38,108 @@ public:
|
||||
m_password = password;
|
||||
}
|
||||
|
||||
template <class Mutable_Buffers, class Handler>
|
||||
void async_read_some(Mutable_Buffers const& buffers, Handler const& handler)
|
||||
{
|
||||
m_sock.async_read_some(buffers, handler);
|
||||
}
|
||||
|
||||
template <class Mutable_Buffers>
|
||||
std::size_t read_some(Mutable_Buffers const& buffers, asio::error_code& ec)
|
||||
{
|
||||
return m_sock.read_some(buffers, ec);
|
||||
}
|
||||
|
||||
template <class Mutable_Buffers>
|
||||
std::size_t read_some(Mutable_Buffers const& buffers)
|
||||
{
|
||||
return m_sock.read_some(buffers);
|
||||
}
|
||||
|
||||
template <class IO_Control_Command>
|
||||
void io_control(IO_Control_Command& ioc)
|
||||
{
|
||||
m_sock.io_control(ioc);
|
||||
}
|
||||
|
||||
template <class IO_Control_Command>
|
||||
void io_control(IO_Control_Command& ioc, asio::error_code& ec)
|
||||
{
|
||||
m_sock.io_control(ioc, ec);
|
||||
}
|
||||
|
||||
template <class Const_Buffers, class Handler>
|
||||
void async_write_some(Const_Buffers const& buffers, Handler const& handler)
|
||||
{
|
||||
m_sock.async_write_some(buffers, handler);
|
||||
}
|
||||
|
||||
void bind(endpoint_type const& endpoint)
|
||||
{
|
||||
m_sock.bind(endpoint);
|
||||
}
|
||||
|
||||
template <class Error_Handler>
|
||||
void bind(endpoint_type const& endpoint, Error_Handler const& error_handler)
|
||||
{
|
||||
m_sock.bind(endpoint, error_handler);
|
||||
}
|
||||
|
||||
void open(protocol_type const& p)
|
||||
{
|
||||
m_sock.open(p);
|
||||
}
|
||||
|
||||
template <class Error_Handler>
|
||||
void open(protocol_type const& p, Error_Handler const& error_handler)
|
||||
{
|
||||
m_sock.open(p, error_handler);
|
||||
}
|
||||
|
||||
void close()
|
||||
{
|
||||
m_remote_endpoint = endpoint_type();
|
||||
m_sock.close();
|
||||
}
|
||||
|
||||
template <class Error_Handler>
|
||||
void close(Error_Handler const& error_handler)
|
||||
{
|
||||
m_sock.close(error_handler);
|
||||
}
|
||||
|
||||
endpoint_type remote_endpoint()
|
||||
{
|
||||
return m_remote_endpoint;
|
||||
}
|
||||
|
||||
template <class Error_Handler>
|
||||
endpoint_type remote_endpoint(Error_Handler const& error_handler)
|
||||
{
|
||||
return m_remote_endpoint;
|
||||
}
|
||||
|
||||
endpoint_type local_endpoint()
|
||||
{
|
||||
return m_sock.local_endpoint();
|
||||
}
|
||||
|
||||
template <class Error_Handler>
|
||||
endpoint_type local_endpoint(Error_Handler const& error_handler)
|
||||
{
|
||||
return m_sock.local_endpoint(error_handler);
|
||||
}
|
||||
|
||||
asio::io_service& io_service()
|
||||
{
|
||||
return m_sock.io_service();
|
||||
}
|
||||
|
||||
lowest_layer_type& lowest_layer()
|
||||
{
|
||||
return m_sock.lowest_layer();
|
||||
}
|
||||
|
||||
typedef boost::function<void(asio::error_code const&)> handler_type;
|
||||
|
||||
template <class Handler>
|
||||
@ -56,12 +171,19 @@ private:
|
||||
void handshake1(asio::error_code const& e, boost::shared_ptr<handler_type> h);
|
||||
void handshake2(asio::error_code const& e, boost::shared_ptr<handler_type> h);
|
||||
|
||||
stream_socket m_sock;
|
||||
// the http proxy
|
||||
std::string m_hostname;
|
||||
int m_port;
|
||||
// send and receive buffer
|
||||
std::vector<char> m_buffer;
|
||||
// proxy authentication
|
||||
std::string m_user;
|
||||
std::string m_password;
|
||||
|
||||
endpoint_type m_remote_endpoint;
|
||||
|
||||
tcp::resolver m_resolver;
|
||||
// this is true if the connection is HTTP based and
|
||||
// want to talk directly to the proxy
|
||||
bool m_no_connect;
|
||||
@ -69,4 +191,3 @@ private:
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -125,8 +125,6 @@ namespace libtorrent
|
||||
piece_picker(int blocks_per_piece
|
||||
, int total_num_blocks);
|
||||
|
||||
void get_availability(std::vector<int>& avail) const;
|
||||
|
||||
void set_sequenced_download_threshold(int sequenced_download_threshold);
|
||||
|
||||
// the vector tells which pieces we already have
|
||||
|
@ -179,6 +179,7 @@ namespace libtorrent
|
||||
|
||||
#ifndef TORRENT_DISABLE_ENCRYPTION
|
||||
void set_pe_settings(pe_settings const& settings);
|
||||
pe_settings const& get_pe_settings() const;
|
||||
#endif
|
||||
|
||||
#ifndef TORRENT_DISABLE_EXTENSIONS
|
||||
|
@ -1,18 +1,33 @@
|
||||
#ifndef TORRENT_SOCKS5_STREAM_HPP_INCLUDED
|
||||
#define TORRENT_SOCKS5_STREAM_HPP_INCLUDED
|
||||
#include "libtorrent/proxy_base.hpp"
|
||||
#include "libtorrent/io.hpp"
|
||||
#include "libtorrent/socket.hpp"
|
||||
#include <boost/bind.hpp>
|
||||
#include <boost/lexical_cast.hpp>
|
||||
#include <boost/function.hpp>
|
||||
#include <asio/read.hpp>
|
||||
#include <asio/write.hpp>
|
||||
|
||||
|
||||
namespace libtorrent {
|
||||
|
||||
class socks5_stream : public proxy_base
|
||||
class socks5_stream : boost::noncopyable
|
||||
{
|
||||
public:
|
||||
|
||||
explicit socks5_stream(asio::io_service& io_service)
|
||||
: proxy_base(io_service)
|
||||
typedef stream_socket::lowest_layer_type lowest_layer_type;
|
||||
typedef stream_socket::endpoint_type endpoint_type;
|
||||
typedef stream_socket::protocol_type protocol_type;
|
||||
|
||||
explicit socks5_stream(asio::io_service& io_service)
|
||||
: m_sock(io_service)
|
||||
, m_resolver(io_service)
|
||||
{}
|
||||
|
||||
void set_proxy(std::string hostname, int port)
|
||||
{
|
||||
m_hostname = hostname;
|
||||
m_port = port;
|
||||
}
|
||||
|
||||
void set_username(std::string const& user
|
||||
, std::string const& password)
|
||||
{
|
||||
@ -20,6 +35,107 @@ public:
|
||||
m_password = password;
|
||||
}
|
||||
|
||||
template <class Mutable_Buffers, class Handler>
|
||||
void async_read_some(Mutable_Buffers const& buffers, Handler const& handler)
|
||||
{
|
||||
m_sock.async_read_some(buffers, handler);
|
||||
}
|
||||
|
||||
template <class Mutable_Buffers>
|
||||
std::size_t read_some(Mutable_Buffers const& buffers, asio::error_code& ec)
|
||||
{
|
||||
return m_sock.read_some(buffers, ec);
|
||||
}
|
||||
|
||||
template <class Mutable_Buffers>
|
||||
std::size_t read_some(Mutable_Buffers const& buffers)
|
||||
{
|
||||
return m_sock.read_some(buffers);
|
||||
}
|
||||
|
||||
template <class IO_Control_Command>
|
||||
void io_control(IO_Control_Command& ioc)
|
||||
{
|
||||
m_sock.io_control(ioc);
|
||||
}
|
||||
|
||||
template <class IO_Control_Command>
|
||||
void io_control(IO_Control_Command& ioc, asio::error_code& ec)
|
||||
{
|
||||
m_sock.io_control(ioc, ec);
|
||||
}
|
||||
|
||||
template <class Const_Buffers, class Handler>
|
||||
void async_write_some(Const_Buffers const& buffers, Handler const& handler)
|
||||
{
|
||||
m_sock.async_write_some(buffers, handler);
|
||||
}
|
||||
|
||||
void bind(endpoint_type const& endpoint)
|
||||
{
|
||||
m_sock.bind(endpoint);
|
||||
}
|
||||
|
||||
template <class Error_Handler>
|
||||
void bind(endpoint_type const& endpoint, Error_Handler const& error_handler)
|
||||
{
|
||||
m_sock.bind(endpoint, error_handler);
|
||||
}
|
||||
|
||||
void open(protocol_type const& p)
|
||||
{
|
||||
m_sock.open(p);
|
||||
}
|
||||
|
||||
template <class Error_Handler>
|
||||
void open(protocol_type const& p, Error_Handler const& error_handler)
|
||||
{
|
||||
m_sock.open(p, error_handler);
|
||||
}
|
||||
|
||||
void close()
|
||||
{
|
||||
m_remote_endpoint = endpoint_type();
|
||||
m_sock.close();
|
||||
}
|
||||
|
||||
template <class Error_Handler>
|
||||
void close(Error_Handler const& error_handler)
|
||||
{
|
||||
m_sock.close(error_handler);
|
||||
}
|
||||
|
||||
endpoint_type remote_endpoint()
|
||||
{
|
||||
return m_remote_endpoint;
|
||||
}
|
||||
|
||||
template <class Error_Handler>
|
||||
endpoint_type remote_endpoint(Error_Handler const& error_handler)
|
||||
{
|
||||
return m_remote_endpoint;
|
||||
}
|
||||
|
||||
endpoint_type local_endpoint()
|
||||
{
|
||||
return m_sock.local_endpoint();
|
||||
}
|
||||
|
||||
template <class Error_Handler>
|
||||
endpoint_type local_endpoint(Error_Handler const& error_handler)
|
||||
{
|
||||
return m_sock.local_endpoint(error_handler);
|
||||
}
|
||||
|
||||
asio::io_service& io_service()
|
||||
{
|
||||
return m_sock.io_service();
|
||||
}
|
||||
|
||||
lowest_layer_type& lowest_layer()
|
||||
{
|
||||
return m_sock.lowest_layer();
|
||||
}
|
||||
|
||||
typedef boost::function<void(asio::error_code const&)> handler_type;
|
||||
|
||||
@ -60,14 +176,20 @@ private:
|
||||
void connect2(asio::error_code const& e, boost::shared_ptr<handler_type> h);
|
||||
void connect3(asio::error_code const& e, boost::shared_ptr<handler_type> h);
|
||||
|
||||
stream_socket m_sock;
|
||||
// the socks5 proxy
|
||||
std::string m_hostname;
|
||||
int m_port;
|
||||
// send and receive buffer
|
||||
std::vector<char> m_buffer;
|
||||
// proxy authentication
|
||||
std::string m_user;
|
||||
std::string m_password;
|
||||
|
||||
endpoint_type m_remote_endpoint;
|
||||
|
||||
tcp::resolver m_resolver;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -184,8 +184,6 @@ namespace libtorrent
|
||||
void filter_files(std::vector<bool> const& files);
|
||||
// ============ end deprecation =============
|
||||
|
||||
void piece_availability(std::vector<int>& avail) const;
|
||||
|
||||
void set_piece_priority(int index, int priority);
|
||||
int piece_priority(int index) const;
|
||||
|
||||
|
@ -269,8 +269,6 @@ namespace libtorrent
|
||||
|
||||
// ================ end deprecation ============
|
||||
|
||||
void piece_availability(std::vector<int>& avail) const;
|
||||
|
||||
// priority must be within the range [0, 7]
|
||||
void piece_priority(int index, int priority) const;
|
||||
int piece_priority(int index) const;
|
||||
|
@ -248,15 +248,15 @@ namespace libtorrent
|
||||
void set_size(size_type s)
|
||||
{
|
||||
size_type pos = tell();
|
||||
seek(s - 1);
|
||||
seek(1, 0);
|
||||
char dummy = 0;
|
||||
read(&dummy, 1);
|
||||
seek(s - 1);
|
||||
seek(1, 0);
|
||||
write(&dummy, 1);
|
||||
seek(pos);
|
||||
seek(pos, 1);
|
||||
}
|
||||
|
||||
size_type seek(size_type offset, int m = 1)
|
||||
size_type seek(size_type offset, int m)
|
||||
{
|
||||
assert(m_open_mode);
|
||||
assert(m_fd != -1);
|
||||
|
@ -1292,17 +1292,6 @@ namespace libtorrent
|
||||
}
|
||||
}
|
||||
|
||||
void piece_picker::get_availability(std::vector<int>& avail) const
|
||||
{
|
||||
TORRENT_PIECE_PICKER_INVARIANT_CHECK;
|
||||
|
||||
avail.resize(m_piece_map.size());
|
||||
std::vector<int>::iterator j = avail.begin();
|
||||
for (std::vector<piece_pos>::const_iterator i = m_piece_map.begin()
|
||||
, end(m_piece_map.end()); i != end; ++i, ++j)
|
||||
*j = i->peer_count;
|
||||
}
|
||||
|
||||
void piece_picker::mark_as_finished(piece_block block, const tcp::endpoint& peer)
|
||||
{
|
||||
TORRENT_PIECE_PICKER_INVARIANT_CHECK;
|
||||
|
@ -252,6 +252,11 @@ namespace libtorrent
|
||||
{
|
||||
m_impl->set_pe_settings(settings);
|
||||
}
|
||||
|
||||
pe_settings const& session::get_pe_settings() const
|
||||
{
|
||||
return m_impl->get_pe_settings();
|
||||
}
|
||||
#endif
|
||||
|
||||
bool session::is_listening() const
|
||||
|
@ -309,7 +309,7 @@ namespace libtorrent
|
||||
#endif
|
||||
}
|
||||
catch (std::exception&) {}
|
||||
if ((compact_mode && size != s->first)
|
||||
if (size != s->first
|
||||
|| (!compact_mode && size < s->first))
|
||||
{
|
||||
if (error) *error = "filesize mismatch for file '"
|
||||
@ -319,7 +319,7 @@ namespace libtorrent
|
||||
+ " bytes";
|
||||
return false;
|
||||
}
|
||||
if ((compact_mode && time != s->second)
|
||||
if (time != s->second
|
||||
|| (!compact_mode && time < s->second))
|
||||
{
|
||||
if (error) *error = "timestamp mismatch for file '"
|
||||
@ -412,7 +412,6 @@ namespace libtorrent
|
||||
|
||||
void storage::initialize(bool allocate_files)
|
||||
{
|
||||
std::cerr << "storage initialize" << std::endl;
|
||||
// first, create all missing directories
|
||||
path last_path;
|
||||
for (torrent_info::file_iterator file_iter = m_info.begin_files(),
|
||||
@ -437,7 +436,6 @@ namespace libtorrent
|
||||
// the directory exits.
|
||||
if (file_iter->size == 0)
|
||||
{
|
||||
std::cerr << "creating empty file: " << file_iter->path.string() << std::endl;
|
||||
file(m_save_path / file_iter->path, file::out);
|
||||
continue;
|
||||
}
|
||||
@ -886,13 +884,13 @@ namespace libtorrent
|
||||
|
||||
if (left_to_write > 0)
|
||||
{
|
||||
#ifndef NDEBUG
|
||||
#ifndef NDEBUG
|
||||
if (write_bytes > 0) ++counter;
|
||||
#endif
|
||||
#endif
|
||||
++file_iter;
|
||||
|
||||
assert(file_iter != m_info.end_files());
|
||||
path p = m_save_path / file_iter->path;
|
||||
path p = m_save_path / file_iter->path;
|
||||
file_offset = 0;
|
||||
out = m_files.open_file(
|
||||
this, p, file::out | file::in);
|
||||
@ -1614,44 +1612,23 @@ namespace libtorrent
|
||||
{
|
||||
m_unallocated_slots.push_back(i);
|
||||
}
|
||||
if (m_compact_mode || m_unallocated_slots.empty())
|
||||
|
||||
if (!m_compact_mode && !m_unallocated_slots.empty())
|
||||
{
|
||||
m_state = state_create_files;
|
||||
std::cerr << "storage: -> create_files" << std::endl;
|
||||
m_state = state_allocating;
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
m_state = state_finished;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
m_current_slot = 0;
|
||||
m_state = state_full_check;
|
||||
std::cerr << "storage: -> full_check" << std::endl;
|
||||
m_state = state_create_files;
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
state chart:
|
||||
|
||||
check_fastresume()
|
||||
|
||||
| |
|
||||
| v
|
||||
| +------------+
|
||||
| | full_check |
|
||||
| +------------+
|
||||
| |
|
||||
| v
|
||||
| +------------+ +--------------+
|
||||
| | allocating |-->| create_files |
|
||||
| +------------+ +--------------+
|
||||
| | |
|
||||
| v |
|
||||
| +----------+ |
|
||||
+---->| finished |<--------+
|
||||
+----------+
|
||||
|
||||
*/
|
||||
|
||||
|
||||
// performs the full check and full allocation
|
||||
// (if necessary). returns true if finished and
|
||||
// false if it should be called again
|
||||
@ -1665,19 +1642,16 @@ namespace libtorrent
|
||||
|
||||
if (m_state == state_allocating)
|
||||
{
|
||||
if (m_compact_mode || m_unallocated_slots.empty())
|
||||
if (m_compact_mode)
|
||||
{
|
||||
m_state = state_create_files;
|
||||
return std::make_pair(false, 1.f);
|
||||
m_state = state_finished;
|
||||
return std::make_pair(true, 1.f);
|
||||
}
|
||||
|
||||
if (int(m_unallocated_slots.size()) == m_info.num_pieces()
|
||||
&& !m_fill_mode)
|
||||
|
||||
if (m_unallocated_slots.empty())
|
||||
{
|
||||
// if there is not a single file on disk, just
|
||||
// create the files
|
||||
m_state = state_create_files;
|
||||
return std::make_pair(false, 1.f);
|
||||
m_state = state_finished;
|
||||
return std::make_pair(true, 1.f);
|
||||
}
|
||||
|
||||
// if we're not in compact mode, make sure the
|
||||
@ -1708,19 +1682,10 @@ namespace libtorrent
|
||||
{
|
||||
m_storage->initialize(!m_fill_mode && !m_compact_mode);
|
||||
|
||||
if (!m_unallocated_slots.empty() && !m_compact_mode)
|
||||
{
|
||||
assert(!m_fill_mode);
|
||||
assert(!m_compact_mode);
|
||||
std::vector<int>().swap(m_unallocated_slots);
|
||||
std::fill(m_slot_to_piece.begin(), m_slot_to_piece.end(), int(unassigned));
|
||||
m_free_slots.resize(m_info.num_pieces());
|
||||
for (int i = 0; i < m_info.num_pieces(); ++i)
|
||||
m_free_slots[i] = i;
|
||||
}
|
||||
|
||||
m_state = state_finished;
|
||||
return std::make_pair(true, 1.f);
|
||||
m_current_slot = 0;
|
||||
m_state = state_full_check;
|
||||
m_piece_data.resize(int(m_info.piece_length()));
|
||||
return std::make_pair(false, 0.f);
|
||||
}
|
||||
|
||||
assert(m_state == state_full_check);
|
||||
@ -1732,7 +1697,6 @@ namespace libtorrent
|
||||
try
|
||||
{
|
||||
|
||||
m_piece_data.resize(int(m_info.piece_length()));
|
||||
int piece_size = int(m_info.piece_size(m_current_slot));
|
||||
int num_read = m_storage->read(&m_piece_data[0]
|
||||
, m_current_slot, 0, piece_size);
|
||||
|
@ -981,20 +981,7 @@ namespace libtorrent
|
||||
return m_username + ":" + m_password;
|
||||
}
|
||||
|
||||
void torrent::piece_availability(std::vector<int>& avail) const
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
assert(valid_metadata());
|
||||
if (is_seed())
|
||||
{
|
||||
avail.clear();
|
||||
return;
|
||||
}
|
||||
|
||||
m_picker->get_availability(avail);
|
||||
}
|
||||
|
||||
|
||||
void torrent::set_piece_priority(int index, int priority)
|
||||
{
|
||||
@ -1819,8 +1806,7 @@ namespace libtorrent
|
||||
bool torrent::want_more_peers() const
|
||||
{
|
||||
return int(m_connections.size()) < m_connections_quota.given
|
||||
&& m_ses.m_half_open.free_slots()
|
||||
&& !m_paused;;
|
||||
&& m_ses.m_half_open.free_slots();
|
||||
}
|
||||
|
||||
void torrent::disconnect_all()
|
||||
|
@ -351,13 +351,6 @@ namespace libtorrent
|
||||
, bind(&torrent::name, _1));
|
||||
}
|
||||
|
||||
void torrent_handle::piece_availability(std::vector<int>& avail) const
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
|
||||
call_member<void>(m_ses, m_chk, m_info_hash
|
||||
, bind(&torrent::piece_availability, _1, boost::ref(avail)));
|
||||
}
|
||||
|
||||
void torrent_handle::piece_priority(int index, int priority) const
|
||||
{
|
||||
@ -563,11 +556,9 @@ namespace libtorrent
|
||||
for (int j = 0; j < num_bitmask_bytes; ++j)
|
||||
{
|
||||
unsigned char v = 0;
|
||||
int bits = std::min(num_blocks_per_piece - j*8, 8);
|
||||
for (int k = 0; k < 8; ++k)
|
||||
v |= i->info[j*8+k].finished?(1 << k):0;
|
||||
bitmask.insert(bitmask.end(), v);
|
||||
assert(bits == 8 || j == num_bitmask_bytes - 1);
|
||||
}
|
||||
piece_struct["bitmask"] = bitmask;
|
||||
|
||||
|
2
setup.py
2
setup.py
@ -24,7 +24,7 @@ if platform.machine() == "i386" or platform.machine() == "i686":
|
||||
elif platform.machine() == "x86_64" or platform.machine() == "amd64":
|
||||
print "64bit x86_64 system detected"
|
||||
ARCH = "x64"
|
||||
elif platform.machine() == "powerpc":
|
||||
elif platform.machine() == "ppc":
|
||||
print "PowerPC system detected"
|
||||
ARCH = "ppc"
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user