some code cleanup and minor refactor

This commit is contained in:
Alden Torres 2018-05-24 12:05:51 -04:00 committed by Arvid Norberg
parent 534276e7a5
commit d6cecee8c0
8 changed files with 6 additions and 10 deletions

View File

@ -38,8 +38,6 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/aux_/block_cache_reference.hpp"
#include "libtorrent/span.hpp"
#include <memory>
namespace libtorrent {
struct TORRENT_EXTRA_EXPORT buffer_allocator_interface

View File

@ -52,7 +52,6 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent {
struct disk_observer;
struct disk_buffer_holder;
struct counters;
struct storage_holder;

View File

@ -33,13 +33,14 @@ POSSIBILITY OF SUCH DAMAGE.
#ifndef TORRENT_INSTANTIATE_CONNECTION
#define TORRENT_INSTANTIATE_CONNECTION
#include "libtorrent/aux_/socket_type.hpp"
#include "libtorrent/aux_/export.hpp"
namespace libtorrent {
namespace aux {
struct proxy_settings;
struct socket_type;
}
struct utp_socket_manager;

View File

@ -1693,9 +1693,9 @@ int block_cache::copy_from_piece(cached_piece_entry* const pe
while (size > 0)
{
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()
+ buffer_offset
+ buffer_offset
, pe->blocks[block].buf + block_offset
, aux::numeric_cast<std::size_t>(to_copy));
pe->blocks[block].cache_hit = 1;

View File

@ -31,7 +31,6 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/disk_buffer_holder.hpp"
#include "libtorrent/storage.hpp" // for storage_interface
namespace libtorrent {

View File

@ -254,7 +254,7 @@ namespace {
}
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)
{
TORRENT_ASSERT(m_torrent.session().is_single_thread());

View File

@ -407,4 +407,3 @@ namespace aux {
}
}

View File

@ -351,7 +351,7 @@ namespace libtorrent {
recv_id = send_id - 1;
}
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;
}
}