lt sync to 1298
This commit is contained in:
parent
8feff006d7
commit
8c35be16b6
|
@ -1,36 +1,53 @@
|
||||||
#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>
|
|
||||||
|
|
||||||
|
Copyright (c) 2007, Arvid Norberg
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in
|
||||||
|
the documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of the author nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived
|
||||||
|
from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TORRENT_HTTP_STREAM_HPP_INCLUDED
|
||||||
|
#define TORRENT_HTTP_STREAM_HPP_INCLUDED
|
||||||
|
|
||||||
|
#include "libtorrent/proxy_base.hpp"
|
||||||
|
|
||||||
namespace libtorrent {
|
namespace libtorrent {
|
||||||
|
|
||||||
class http_stream : boost::noncopyable
|
class http_stream : public proxy_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
typedef stream_socket::lowest_layer_type lowest_layer_type;
|
|
||||||
typedef stream_socket::endpoint_type endpoint_type;
|
|
||||||
typedef stream_socket::protocol_type protocol_type;
|
|
||||||
|
|
||||||
explicit http_stream(asio::io_service& io_service)
|
explicit http_stream(asio::io_service& io_service)
|
||||||
: m_sock(io_service)
|
: proxy_base(io_service)
|
||||||
, m_resolver(io_service)
|
|
||||||
, m_no_connect(false)
|
, m_no_connect(false)
|
||||||
{}
|
{}
|
||||||
|
|
||||||
void set_no_connect(bool c) { m_no_connect = c; }
|
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
|
void set_username(std::string const& user
|
||||||
, std::string const& password)
|
, std::string const& password)
|
||||||
{
|
{
|
||||||
|
@ -38,108 +55,6 @@ public:
|
||||||
m_password = password;
|
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;
|
typedef boost::function<void(asio::error_code const&)> handler_type;
|
||||||
|
|
||||||
template <class Handler>
|
template <class Handler>
|
||||||
|
@ -171,19 +86,12 @@ private:
|
||||||
void handshake1(asio::error_code const& e, boost::shared_ptr<handler_type> h);
|
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);
|
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
|
// send and receive buffer
|
||||||
std::vector<char> m_buffer;
|
std::vector<char> m_buffer;
|
||||||
// proxy authentication
|
// proxy authentication
|
||||||
std::string m_user;
|
std::string m_user;
|
||||||
std::string m_password;
|
std::string m_password;
|
||||||
|
|
||||||
endpoint_type m_remote_endpoint;
|
|
||||||
|
|
||||||
tcp::resolver m_resolver;
|
|
||||||
// this is true if the connection is HTTP based and
|
// this is true if the connection is HTTP based and
|
||||||
// want to talk directly to the proxy
|
// want to talk directly to the proxy
|
||||||
bool m_no_connect;
|
bool m_no_connect;
|
||||||
|
@ -191,3 +99,5 @@ private:
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -125,6 +125,8 @@ namespace libtorrent
|
||||||
piece_picker(int blocks_per_piece
|
piece_picker(int blocks_per_piece
|
||||||
, int total_num_blocks);
|
, int total_num_blocks);
|
||||||
|
|
||||||
|
void get_availability(std::vector<int>& avail) const;
|
||||||
|
|
||||||
void set_sequenced_download_threshold(int sequenced_download_threshold);
|
void set_sequenced_download_threshold(int sequenced_download_threshold);
|
||||||
|
|
||||||
// the vector tells which pieces we already have
|
// the vector tells which pieces we already have
|
||||||
|
@ -412,3 +414,4 @@ namespace libtorrent
|
||||||
|
|
||||||
#endif // TORRENT_PIECE_PICKER_HPP_INCLUDED
|
#endif // TORRENT_PIECE_PICKER_HPP_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1,33 +1,50 @@
|
||||||
#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>
|
|
||||||
|
|
||||||
|
Copyright (c) 2007, Arvid Norberg
|
||||||
|
All rights reserved.
|
||||||
|
|
||||||
|
Redistribution and use in source and binary forms, with or without
|
||||||
|
modification, are permitted provided that the following conditions
|
||||||
|
are met:
|
||||||
|
|
||||||
|
* Redistributions of source code must retain the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
* Redistributions in binary form must reproduce the above copyright
|
||||||
|
notice, this list of conditions and the following disclaimer in
|
||||||
|
the documentation and/or other materials provided with the distribution.
|
||||||
|
* Neither the name of the author nor the names of its
|
||||||
|
contributors may be used to endorse or promote products derived
|
||||||
|
from this software without specific prior written permission.
|
||||||
|
|
||||||
|
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||||
|
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||||
|
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||||
|
ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||||
|
LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||||
|
CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||||
|
SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||||
|
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||||
|
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||||
|
ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||||
|
POSSIBILITY OF SUCH DAMAGE.
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef TORRENT_SOCKS5_STREAM_HPP_INCLUDED
|
||||||
|
#define TORRENT_SOCKS5_STREAM_HPP_INCLUDED
|
||||||
|
|
||||||
|
#include "libtorrent/proxy_base.hpp"
|
||||||
|
|
||||||
namespace libtorrent {
|
namespace libtorrent {
|
||||||
|
|
||||||
class socks5_stream : boost::noncopyable
|
class socks5_stream : public proxy_base
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
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)
|
explicit socks5_stream(asio::io_service& io_service)
|
||||||
: m_sock(io_service)
|
: proxy_base(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
|
void set_username(std::string const& user
|
||||||
, std::string const& password)
|
, std::string const& password)
|
||||||
{
|
{
|
||||||
|
@ -35,108 +52,6 @@ public:
|
||||||
m_password = password;
|
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;
|
typedef boost::function<void(asio::error_code const&)> handler_type;
|
||||||
|
|
||||||
template <class Handler>
|
template <class Handler>
|
||||||
|
@ -176,20 +91,14 @@ private:
|
||||||
void connect2(asio::error_code const& e, boost::shared_ptr<handler_type> h);
|
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);
|
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
|
// send and receive buffer
|
||||||
std::vector<char> m_buffer;
|
std::vector<char> m_buffer;
|
||||||
// proxy authentication
|
// proxy authentication
|
||||||
std::string m_user;
|
std::string m_user;
|
||||||
std::string m_password;
|
std::string m_password;
|
||||||
|
|
||||||
endpoint_type m_remote_endpoint;
|
|
||||||
|
|
||||||
tcp::resolver m_resolver;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -184,6 +184,8 @@ namespace libtorrent
|
||||||
void filter_files(std::vector<bool> const& files);
|
void filter_files(std::vector<bool> const& files);
|
||||||
// ============ end deprecation =============
|
// ============ end deprecation =============
|
||||||
|
|
||||||
|
void piece_availability(std::vector<int>& avail) const;
|
||||||
|
|
||||||
void set_piece_priority(int index, int priority);
|
void set_piece_priority(int index, int priority);
|
||||||
int piece_priority(int index) const;
|
int piece_priority(int index) const;
|
||||||
|
|
||||||
|
|
|
@ -269,6 +269,8 @@ namespace libtorrent
|
||||||
|
|
||||||
// ================ end deprecation ============
|
// ================ end deprecation ============
|
||||||
|
|
||||||
|
void piece_availability(std::vector<int>& avail) const;
|
||||||
|
|
||||||
// priority must be within the range [0, 7]
|
// priority must be within the range [0, 7]
|
||||||
void piece_priority(int index, int priority) const;
|
void piece_priority(int index, int priority) const;
|
||||||
int piece_priority(int index) const;
|
int piece_priority(int index) const;
|
||||||
|
@ -374,3 +376,4 @@ namespace libtorrent
|
||||||
|
|
||||||
#endif // TORRENT_TORRENT_HANDLE_HPP_INCLUDED
|
#endif // TORRENT_TORRENT_HANDLE_HPP_INCLUDED
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -197,7 +197,7 @@ namespace
|
||||||
, {"XT", "XanTorrent"}
|
, {"XT", "XanTorrent"}
|
||||||
, {"XX", "Xtorrent"}
|
, {"XX", "Xtorrent"}
|
||||||
, {"ZT", "ZipTorrent"}
|
, {"ZT", "ZipTorrent"}
|
||||||
, {"lt", "libTorrent (libtorrent.rakshasa.no/}"}
|
, {"lt", "rTorrent"}
|
||||||
, {"pX", "pHoeniX"}
|
, {"pX", "pHoeniX"}
|
||||||
, {"qB", "qBittorrent"}
|
, {"qB", "qBittorrent"}
|
||||||
};
|
};
|
||||||
|
@ -349,3 +349,4 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1292,6 +1292,17 @@ 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)
|
void piece_picker::mark_as_finished(piece_block block, const tcp::endpoint& peer)
|
||||||
{
|
{
|
||||||
TORRENT_PIECE_PICKER_INVARIANT_CHECK;
|
TORRENT_PIECE_PICKER_INVARIANT_CHECK;
|
||||||
|
@ -1444,3 +1455,4 @@ namespace libtorrent
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -981,7 +981,19 @@ namespace libtorrent
|
||||||
return m_username + ":" + m_password;
|
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)
|
void torrent::set_piece_priority(int index, int priority)
|
||||||
{
|
{
|
||||||
|
|
|
@ -352,6 +352,14 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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
|
void torrent_handle::piece_priority(int index, int priority) const
|
||||||
{
|
{
|
||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
|
@ -772,3 +780,4 @@ namespace libtorrent
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue