forked from premiere/premiere-libtorrent
separate piece_block and has_block out to their own headers (#1148)
This commit is contained in:
parent
48a647a169
commit
d2002c5248
|
@ -93,6 +93,7 @@ nobase_include_HEADERS = \
|
||||||
peer_id.hpp \
|
peer_id.hpp \
|
||||||
peer_info.hpp \
|
peer_info.hpp \
|
||||||
peer_request.hpp \
|
peer_request.hpp \
|
||||||
|
piece_block.hpp \
|
||||||
piece_block_progress.hpp \
|
piece_block_progress.hpp \
|
||||||
piece_picker.hpp \
|
piece_picker.hpp \
|
||||||
platform_util.hpp \
|
platform_util.hpp \
|
||||||
|
@ -177,6 +178,7 @@ nobase_include_HEADERS = \
|
||||||
aux_/ffs.hpp \
|
aux_/ffs.hpp \
|
||||||
aux_/portmap.hpp \
|
aux_/portmap.hpp \
|
||||||
aux_/lsd.hpp \
|
aux_/lsd.hpp \
|
||||||
|
aux_/has_block.hpp \
|
||||||
\
|
\
|
||||||
extensions/smart_ban.hpp \
|
extensions/smart_ban.hpp \
|
||||||
extensions/ut_metadata.hpp \
|
extensions/ut_metadata.hpp \
|
||||||
|
|
|
@ -48,6 +48,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/performance_counters.hpp"
|
#include "libtorrent/performance_counters.hpp"
|
||||||
#include "libtorrent/operations.hpp" // for operation_t enum
|
#include "libtorrent/operations.hpp" // for operation_t enum
|
||||||
#include "libtorrent/close_reason.hpp"
|
#include "libtorrent/close_reason.hpp"
|
||||||
|
#include "libtorrent/piece_block.hpp"
|
||||||
#include "libtorrent/aux_/escape_string.hpp" // for convert_from_native
|
#include "libtorrent/aux_/escape_string.hpp" // for convert_from_native
|
||||||
|
|
||||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
||||||
|
@ -62,7 +63,6 @@ namespace libtorrent
|
||||||
namespace aux {
|
namespace aux {
|
||||||
struct stack_allocator;
|
struct stack_allocator;
|
||||||
}
|
}
|
||||||
struct piece_block;
|
|
||||||
|
|
||||||
// maps an operation id (from peer_error_alert and peer_disconnected_alert)
|
// maps an operation id (from peer_error_alert and peer_disconnected_alert)
|
||||||
// to its name. See peer_connection for the constants
|
// to its name. See peer_connection for the constants
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
Copyright (c) 2016, 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_HAS_BLOCK_HPP_INCLUDED
|
||||||
|
#define TORRENT_HAS_BLOCK_HPP_INCLUDED
|
||||||
|
|
||||||
|
#include "libtorrent/piece_block.hpp"
|
||||||
|
|
||||||
|
namespace libtorrent { namespace aux {
|
||||||
|
struct has_block
|
||||||
|
{
|
||||||
|
has_block(has_block const&) = default;
|
||||||
|
|
||||||
|
has_block(piece_block const& b): block(b) {}
|
||||||
|
bool operator()(pending_block const& pb) const
|
||||||
|
{ return pb.block == block; }
|
||||||
|
private:
|
||||||
|
piece_block const& block;
|
||||||
|
// explicitly disallow assignment, to silence msvc warning
|
||||||
|
has_block& operator=(has_block const&);
|
||||||
|
};
|
||||||
|
|
||||||
|
}}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
|
@ -55,7 +55,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/aux_/session_settings.hpp"
|
#include "libtorrent/aux_/session_settings.hpp"
|
||||||
#include "libtorrent/disk_observer.hpp"
|
#include "libtorrent/disk_observer.hpp"
|
||||||
#include "libtorrent/peer_connection_interface.hpp"
|
#include "libtorrent/peer_connection_interface.hpp"
|
||||||
#include "libtorrent/piece_picker.hpp" // for piece_block
|
|
||||||
#include "libtorrent/socket.hpp" // for tcp::endpoint
|
#include "libtorrent/socket.hpp" // for tcp::endpoint
|
||||||
#include "libtorrent/io_service_fwd.hpp"
|
#include "libtorrent/io_service_fwd.hpp"
|
||||||
#include "libtorrent/receive_buffer.hpp"
|
#include "libtorrent/receive_buffer.hpp"
|
||||||
|
@ -63,6 +62,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/aux_/time.hpp"
|
#include "libtorrent/aux_/time.hpp"
|
||||||
#include "libtorrent/debug.hpp"
|
#include "libtorrent/debug.hpp"
|
||||||
#include "libtorrent/span.hpp"
|
#include "libtorrent/span.hpp"
|
||||||
|
#include "libtorrent/piece_block.hpp"
|
||||||
|
|
||||||
#include <ctime>
|
#include <ctime>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
@ -73,10 +73,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include <array>
|
#include <array>
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
|
|
||||||
#include "libtorrent/aux_/disable_warnings_push.hpp"
|
|
||||||
#include <boost/noncopyable.hpp>
|
|
||||||
#include "libtorrent/aux_/disable_warnings_pop.hpp"
|
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
class torrent;
|
class torrent;
|
||||||
|
@ -136,19 +132,6 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct has_block
|
|
||||||
{
|
|
||||||
has_block(has_block const&) = default;
|
|
||||||
|
|
||||||
has_block(piece_block const& b): block(b) {}
|
|
||||||
piece_block const& block;
|
|
||||||
bool operator()(pending_block const& pb) const
|
|
||||||
{ return pb.block == block; }
|
|
||||||
private:
|
|
||||||
// explicitly disallow assignment, to silence msvc warning
|
|
||||||
has_block& operator=(has_block const&);
|
|
||||||
};
|
|
||||||
|
|
||||||
// argument pack passed to peer_connection constructor
|
// argument pack passed to peer_connection constructor
|
||||||
struct peer_connection_args
|
struct peer_connection_args
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,66 @@
|
||||||
|
/*
|
||||||
|
|
||||||
|
Copyright (c) 2016, 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_PIECE_BLOCK_HPP_INCLUDED
|
||||||
|
#define TORRENT_PIECE_BLOCK_HPP_INCLUDED
|
||||||
|
|
||||||
|
namespace libtorrent
|
||||||
|
{
|
||||||
|
struct TORRENT_EXTRA_EXPORT piece_block
|
||||||
|
{
|
||||||
|
static const piece_block invalid;
|
||||||
|
|
||||||
|
piece_block() {}
|
||||||
|
piece_block(int p_index, int b_index)
|
||||||
|
: piece_index(p_index)
|
||||||
|
, block_index(b_index)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
int piece_index;
|
||||||
|
int block_index;
|
||||||
|
|
||||||
|
bool operator<(piece_block const& b) const
|
||||||
|
{
|
||||||
|
if (piece_index < b.piece_index) return true;
|
||||||
|
if (piece_index == b.piece_index) return block_index < b.block_index;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool operator==(piece_block const& b) const
|
||||||
|
{ return piece_index == b.piece_index && block_index == b.block_index; }
|
||||||
|
|
||||||
|
bool operator!=(piece_block const& b) const
|
||||||
|
{ return piece_index != b.piece_index || block_index != b.block_index; }
|
||||||
|
};
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -54,6 +54,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/peer_id.hpp"
|
#include "libtorrent/peer_id.hpp"
|
||||||
#include "libtorrent/assert.hpp"
|
#include "libtorrent/assert.hpp"
|
||||||
#include "libtorrent/time.hpp"
|
#include "libtorrent/time.hpp"
|
||||||
|
#include "libtorrent/piece_block.hpp"
|
||||||
|
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
@ -64,33 +65,6 @@ namespace libtorrent
|
||||||
struct counters;
|
struct counters;
|
||||||
struct torrent_peer;
|
struct torrent_peer;
|
||||||
|
|
||||||
struct TORRENT_EXTRA_EXPORT piece_block
|
|
||||||
{
|
|
||||||
static const piece_block invalid;
|
|
||||||
|
|
||||||
piece_block() {}
|
|
||||||
piece_block(int p_index, int b_index)
|
|
||||||
: piece_index(p_index)
|
|
||||||
, block_index(b_index)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
int piece_index;
|
|
||||||
int block_index;
|
|
||||||
|
|
||||||
bool operator<(piece_block const& b) const
|
|
||||||
{
|
|
||||||
if (piece_index < b.piece_index) return true;
|
|
||||||
if (piece_index == b.piece_index) return block_index < b.block_index;
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(piece_block const& b) const
|
|
||||||
{ return piece_index == b.piece_index && block_index == b.block_index; }
|
|
||||||
|
|
||||||
bool operator!=(piece_block const& b) const
|
|
||||||
{ return piece_index != b.piece_index || block_index != b.block_index; }
|
|
||||||
};
|
|
||||||
|
|
||||||
class TORRENT_EXTRA_EXPORT piece_picker
|
class TORRENT_EXTRA_EXPORT piece_picker
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
|
@ -65,6 +65,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/vector_utils.hpp"
|
#include "libtorrent/vector_utils.hpp"
|
||||||
#include "libtorrent/linked_list.hpp"
|
#include "libtorrent/linked_list.hpp"
|
||||||
#include "libtorrent/debug.hpp"
|
#include "libtorrent/debug.hpp"
|
||||||
|
#include "libtorrent/piece_block.hpp"
|
||||||
#include "libtorrent/aux_/file_progress.hpp"
|
#include "libtorrent/aux_/file_progress.hpp"
|
||||||
#include "libtorrent/aux_/suggest_piece.hpp"
|
#include "libtorrent/aux_/suggest_piece.hpp"
|
||||||
|
|
||||||
|
|
|
@ -43,7 +43,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/torrent.hpp"
|
#include "libtorrent/torrent.hpp"
|
||||||
#include "libtorrent/performance_counters.hpp"
|
#include "libtorrent/performance_counters.hpp"
|
||||||
#include "libtorrent/stack_allocator.hpp"
|
#include "libtorrent/stack_allocator.hpp"
|
||||||
#include "libtorrent/piece_picker.hpp" // for piece_block
|
#include "libtorrent/piece_block.hpp"
|
||||||
#include "libtorrent/hex.hpp" // to_hex
|
#include "libtorrent/hex.hpp" // to_hex
|
||||||
|
|
||||||
#include "libtorrent/aux_/escape_string.hpp" // for convert_from_native
|
#include "libtorrent/aux_/escape_string.hpp" // for convert_from_native
|
||||||
|
|
|
@ -61,6 +61,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/ip_filter.hpp"
|
#include "libtorrent/ip_filter.hpp"
|
||||||
#include "libtorrent/kademlia/node_id.hpp"
|
#include "libtorrent/kademlia/node_id.hpp"
|
||||||
#include "libtorrent/close_reason.hpp"
|
#include "libtorrent/close_reason.hpp"
|
||||||
|
#include "libtorrent/aux_/has_block.hpp"
|
||||||
#include "libtorrent/aux_/time.hpp"
|
#include "libtorrent/aux_/time.hpp"
|
||||||
|
|
||||||
#if TORRENT_USE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
|
@ -2471,7 +2472,7 @@ namespace libtorrent
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
piece_block b(r.piece, r.start / t->block_size());
|
piece_block const b(r.piece, r.start / t->block_size());
|
||||||
m_receiving_block = b;
|
m_receiving_block = b;
|
||||||
|
|
||||||
bool in_req_queue = false;
|
bool in_req_queue = false;
|
||||||
|
@ -2694,7 +2695,7 @@ namespace libtorrent
|
||||||
= std::find_if(
|
= std::find_if(
|
||||||
m_download_queue.begin()
|
m_download_queue.begin()
|
||||||
, m_download_queue.end()
|
, m_download_queue.end()
|
||||||
, has_block(block_finished));
|
, aux::has_block(block_finished));
|
||||||
|
|
||||||
if (b == m_download_queue.end())
|
if (b == m_download_queue.end())
|
||||||
{
|
{
|
||||||
|
@ -3352,7 +3353,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(is_single_thread());
|
TORRENT_ASSERT(is_single_thread());
|
||||||
std::vector<pending_block>::iterator rit = std::find_if(m_request_queue.begin()
|
std::vector<pending_block>::iterator rit = std::find_if(m_request_queue.begin()
|
||||||
, m_request_queue.end(), has_block(block));
|
, m_request_queue.end(), aux::has_block(block));
|
||||||
if (rit == m_request_queue.end()) return false;
|
if (rit == m_request_queue.end()) return false;
|
||||||
#if TORRENT_USE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
std::shared_ptr<torrent> t = m_torrent.lock();
|
std::shared_ptr<torrent> t = m_torrent.lock();
|
||||||
|
@ -3387,7 +3388,7 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(!t->picker().is_requested(block) || (t->picker().num_peers(block) > 0));
|
TORRENT_ASSERT(!t->picker().is_requested(block) || (t->picker().num_peers(block) > 0));
|
||||||
TORRENT_ASSERT(!t->have_piece(block.piece_index));
|
TORRENT_ASSERT(!t->have_piece(block.piece_index));
|
||||||
TORRENT_ASSERT(std::find_if(m_download_queue.begin(), m_download_queue.end()
|
TORRENT_ASSERT(std::find_if(m_download_queue.begin(), m_download_queue.end()
|
||||||
, has_block(block)) == m_download_queue.end());
|
, aux::has_block(block)) == m_download_queue.end());
|
||||||
TORRENT_ASSERT(std::find(m_request_queue.begin(), m_request_queue.end()
|
TORRENT_ASSERT(std::find(m_request_queue.begin(), m_request_queue.end()
|
||||||
, block) == m_request_queue.end());
|
, block) == m_request_queue.end());
|
||||||
|
|
||||||
|
@ -3556,11 +3557,12 @@ namespace libtorrent
|
||||||
if (!t->picker().is_requested(block)) return;
|
if (!t->picker().is_requested(block)) return;
|
||||||
|
|
||||||
std::vector<pending_block>::iterator it
|
std::vector<pending_block>::iterator it
|
||||||
= std::find_if(m_download_queue.begin(), m_download_queue.end(), has_block(block));
|
= std::find_if(m_download_queue.begin(), m_download_queue.end()
|
||||||
|
, aux::has_block(block));
|
||||||
if (it == m_download_queue.end())
|
if (it == m_download_queue.end())
|
||||||
{
|
{
|
||||||
std::vector<pending_block>::iterator rit = std::find_if(m_request_queue.begin()
|
std::vector<pending_block>::iterator rit = std::find_if(m_request_queue.begin()
|
||||||
, m_request_queue.end(), has_block(block));
|
, m_request_queue.end(), aux::has_block(block));
|
||||||
|
|
||||||
// when a multi block is received, it is cancelled
|
// when a multi block is received, it is cancelled
|
||||||
// from all peers, so if this one hasn't requested
|
// from all peers, so if this one hasn't requested
|
||||||
|
|
|
@ -61,6 +61,7 @@ using namespace std::placeholders;
|
||||||
namespace libtorrent
|
namespace libtorrent
|
||||||
{
|
{
|
||||||
|
|
||||||
|
// TODO: find a better place for this
|
||||||
const piece_block piece_block::invalid((std::numeric_limits<int>::max)(), (std::numeric_limits<int>::max)());
|
const piece_block piece_block::invalid((std::numeric_limits<int>::max)(), (std::numeric_limits<int>::max)());
|
||||||
|
|
||||||
piece_picker::piece_picker()
|
piece_picker::piece_picker()
|
||||||
|
|
|
@ -38,6 +38,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/performance_counters.hpp" // for counters
|
#include "libtorrent/performance_counters.hpp" // for counters
|
||||||
#include "libtorrent/request_blocks.hpp"
|
#include "libtorrent/request_blocks.hpp"
|
||||||
#include "libtorrent/alert_manager.hpp"
|
#include "libtorrent/alert_manager.hpp"
|
||||||
|
#include "libtorrent/aux_/has_block.hpp"
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -231,12 +232,12 @@ namespace libtorrent
|
||||||
// pieces we didn't request. Those aren't marked in the
|
// pieces we didn't request. Those aren't marked in the
|
||||||
// piece picker, but we still keep track of them in the
|
// piece picker, but we still keep track of them in the
|
||||||
// download queue
|
// download queue
|
||||||
if (std::find_if(dq.begin(), dq.end(), has_block(*i)) != dq.end()
|
if (std::find_if(dq.begin(), dq.end(), aux::has_block(*i)) != dq.end()
|
||||||
|| std::find_if(rq.begin(), rq.end(), has_block(*i)) != rq.end())
|
|| std::find_if(rq.begin(), rq.end(), aux::has_block(*i)) != rq.end())
|
||||||
{
|
{
|
||||||
#if TORRENT_USE_ASSERTS
|
#if TORRENT_USE_ASSERTS
|
||||||
std::vector<pending_block>::const_iterator j
|
std::vector<pending_block>::const_iterator j
|
||||||
= std::find_if(dq.begin(), dq.end(), has_block(*i));
|
= std::find_if(dq.begin(), dq.end(), aux::has_block(*i));
|
||||||
if (j != dq.end()) TORRENT_ASSERT(j->timed_out || j->not_wanted);
|
if (j != dq.end()) TORRENT_ASSERT(j->timed_out || j->not_wanted);
|
||||||
#endif
|
#endif
|
||||||
#ifndef TORRENT_DISABLE_LOGGING
|
#ifndef TORRENT_DISABLE_LOGGING
|
||||||
|
|
|
@ -89,6 +89,7 @@ POSSIBILITY OF SUCH DAMAGE.
|
||||||
#include "libtorrent/alloca.hpp"
|
#include "libtorrent/alloca.hpp"
|
||||||
#include "libtorrent/resolve_links.hpp"
|
#include "libtorrent/resolve_links.hpp"
|
||||||
#include "libtorrent/aux_/file_progress.hpp"
|
#include "libtorrent/aux_/file_progress.hpp"
|
||||||
|
#include "libtorrent/aux_/has_block.hpp"
|
||||||
#include "libtorrent/alert_manager.hpp"
|
#include "libtorrent/alert_manager.hpp"
|
||||||
#include "libtorrent/disk_interface.hpp"
|
#include "libtorrent/disk_interface.hpp"
|
||||||
#include "libtorrent/broadcast_socket.hpp" // for is_ip_address
|
#include "libtorrent/broadcast_socket.hpp" // for is_ip_address
|
||||||
|
@ -10013,8 +10014,8 @@ namespace libtorrent
|
||||||
// same peer
|
// same peer
|
||||||
std::vector<pending_block> const& dq = c.download_queue();
|
std::vector<pending_block> const& dq = c.download_queue();
|
||||||
|
|
||||||
bool already_requested = std::find_if(dq.begin(), dq.end()
|
bool const already_requested = std::find_if(dq.begin(), dq.end()
|
||||||
, has_block(b)) != dq.end();
|
, aux::has_block(b)) != dq.end();
|
||||||
|
|
||||||
if (already_requested)
|
if (already_requested)
|
||||||
{
|
{
|
||||||
|
@ -10035,8 +10036,8 @@ namespace libtorrent
|
||||||
|
|
||||||
std::vector<pending_block> const& rq = c.request_queue();
|
std::vector<pending_block> const& rq = c.request_queue();
|
||||||
|
|
||||||
bool already_in_queue = std::find_if(rq.begin(), rq.end()
|
bool const already_in_queue = std::find_if(rq.begin(), rq.end()
|
||||||
, has_block(b)) != rq.end();
|
, aux::has_block(b)) != rq.end();
|
||||||
|
|
||||||
if (already_in_queue)
|
if (already_in_queue)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue