some code cleanup and minor refactor
This commit is contained in:
parent
534276e7a5
commit
d6cecee8c0
@ -38,8 +38,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#include "libtorrent/aux_/block_cache_reference.hpp"
|
#include "libtorrent/aux_/block_cache_reference.hpp"
|
||||||
#include "libtorrent/span.hpp"
|
#include "libtorrent/span.hpp"
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
namespace libtorrent {
|
namespace libtorrent {
|
||||||
|
|
||||||
struct TORRENT_EXTRA_EXPORT buffer_allocator_interface
|
struct TORRENT_EXTRA_EXPORT buffer_allocator_interface
|
||||||
|
@ -52,7 +52,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
namespace libtorrent {
|
namespace libtorrent {
|
||||||
|
|
||||||
struct disk_observer;
|
struct disk_observer;
|
||||||
struct disk_buffer_holder;
|
|
||||||
struct counters;
|
struct counters;
|
||||||
|
|
||||||
struct storage_holder;
|
struct storage_holder;
|
||||||
|
@ -33,13 +33,14 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
#ifndef TORRENT_INSTANTIATE_CONNECTION
|
#ifndef TORRENT_INSTANTIATE_CONNECTION
|
||||||
#define TORRENT_INSTANTIATE_CONNECTION
|
#define TORRENT_INSTANTIATE_CONNECTION
|
||||||
|
|
||||||
#include "libtorrent/aux_/socket_type.hpp"
|
#include "libtorrent/aux_/export.hpp"
|
||||||
|
|
||||||
namespace libtorrent {
|
namespace libtorrent {
|
||||||
|
|
||||||
namespace aux {
|
namespace aux {
|
||||||
|
|
||||||
struct proxy_settings;
|
struct proxy_settings;
|
||||||
|
struct socket_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
struct utp_socket_manager;
|
struct utp_socket_manager;
|
||||||
|
@ -1693,9 +1693,9 @@ int block_cache::copy_from_piece(cached_piece_entry* const pe
|
|||||||
while (size > 0)
|
while (size > 0)
|
||||||
{
|
{
|
||||||
TORRENT_PIECE_ASSERT(pe->blocks[block].buf, pe);
|
TORRENT_PIECE_ASSERT(pe->blocks[block].buf, pe);
|
||||||
int to_copy = std::min(default_block_size - block_offset, size);
|
int const to_copy = std::min(default_block_size - block_offset, size);
|
||||||
std::memcpy(boost::get<disk_buffer_holder>(j->argument).get()
|
std::memcpy(boost::get<disk_buffer_holder>(j->argument).get()
|
||||||
+ buffer_offset
|
+ buffer_offset
|
||||||
, pe->blocks[block].buf + block_offset
|
, pe->blocks[block].buf + block_offset
|
||||||
, aux::numeric_cast<std::size_t>(to_copy));
|
, aux::numeric_cast<std::size_t>(to_copy));
|
||||||
pe->blocks[block].cache_hit = 1;
|
pe->blocks[block].cache_hit = 1;
|
||||||
|
@ -31,7 +31,6 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "libtorrent/disk_buffer_holder.hpp"
|
#include "libtorrent/disk_buffer_holder.hpp"
|
||||||
#include "libtorrent/storage.hpp" // for storage_interface
|
|
||||||
|
|
||||||
namespace libtorrent {
|
namespace libtorrent {
|
||||||
|
|
||||||
|
@ -254,7 +254,7 @@ namespace {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void on_read_ok_block(std::pair<piece_block, block_entry> const b
|
void on_read_ok_block(std::pair<piece_block, block_entry> const b
|
||||||
, address const a, disk_buffer_holder buffer, int const block_size
|
, address const& a, disk_buffer_holder buffer, int const block_size
|
||||||
, disk_job_flags_t, storage_error const& error)
|
, disk_job_flags_t, storage_error const& error)
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(m_torrent.session().is_single_thread());
|
TORRENT_ASSERT(m_torrent.session().is_single_thread());
|
||||||
|
@ -407,4 +407,3 @@ namespace aux {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -351,7 +351,7 @@ namespace libtorrent {
|
|||||||
recv_id = send_id - 1;
|
recv_id = send_id - 1;
|
||||||
}
|
}
|
||||||
utp_socket_impl* impl = construct_utp_impl(recv_id, send_id, str, *this);
|
utp_socket_impl* impl = construct_utp_impl(recv_id, send_id, str, *this);
|
||||||
m_utp_sockets.insert(std::make_pair(recv_id, impl));
|
m_utp_sockets.emplace(recv_id, impl);
|
||||||
return impl;
|
return impl;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user