making disk_buffer_holder internal and include cleanup (#827)

making disk_buffer_holder internal and include cleanup
This commit is contained in:
Alden Torres 2016-06-17 17:40:22 -04:00 committed by Arvid Norberg
parent 2cc1054d7d
commit efa8bb0fc7
5 changed files with 13 additions and 11 deletions

View File

@ -36,12 +36,10 @@ POSSIBILITY OF SUCH DAMAGE.
#include "libtorrent/config.hpp"
#include "libtorrent/assert.hpp"
#include "libtorrent/disk_io_job.hpp" // for block_cache_reference
#include <algorithm>
#include "libtorrent/aux_/disable_warnings_push.hpp"
#include <boost/shared_ptr.hpp>
#include <boost/function.hpp>
#include "libtorrent/aux_/disable_warnings_pop.hpp"
@ -69,7 +67,7 @@ namespace libtorrent
//
// ``get()`` returns the pointer without transferring ownership. If
// this buffer has been released, ``get()`` will return nullptr.
struct TORRENT_EXPORT disk_buffer_holder
struct TORRENT_EXTRA_EXPORT disk_buffer_holder
{
// internal
disk_buffer_holder(buffer_allocator_interface& alloc, char* buf);
@ -126,4 +124,3 @@ namespace libtorrent
}
#endif

View File

@ -180,7 +180,6 @@ namespace libtorrent
struct peer_request;
class entry;
struct bdecode_node;
struct disk_buffer_holder;
struct bitfield;
class alert;
struct torrent_plugin;
@ -425,8 +424,16 @@ namespace libtorrent
virtual bool on_have_none() { return false; }
virtual bool on_allowed_fast(int /*index*/) { return false; }
virtual bool on_request(peer_request const&) { return false; }
// This function is called when the peer connection is receiving
// a piece. ``buf`` points (non-owning pointer) to the data in an
// internal immutable disk buffer. The length of the data is specified
// in the ``length`` member of the ``piece`` parameter.
// returns true to indicate that the piece is handled and the
// rest of the logic should be ignored.
virtual bool on_piece(peer_request const& /*piece*/
, disk_buffer_holder& /*data*/) { return false; }
, char const* /*buf*/) { return false; }
virtual bool on_cancel(peer_request const&) { return false; }
virtual bool on_reject(peer_request const&) { return false; }
virtual bool on_suggest(int /*index*/) { return false; }

View File

@ -79,7 +79,7 @@ namespace libtorrent
public:
// this is the constructor where the we are the active part.
// The peer_conenction should handshake and verify that the
// The peer_connection should handshake and verify that the
// other end has the correct id
web_connection_base(peer_connection_args const& pack
, web_seed_t& web);

View File

@ -31,8 +31,7 @@ POSSIBILITY OF SUCH DAMAGE.
*/
#include "libtorrent/disk_buffer_holder.hpp"
#include "libtorrent/aux_/session_impl.hpp"
#include "libtorrent/disk_io_thread.hpp"
#include "libtorrent/storage.hpp" // for piece_manager
namespace libtorrent
{
@ -105,4 +104,3 @@ namespace libtorrent
disk_buffer_holder::~disk_buffer_holder() { reset(); }
}

View File

@ -2675,7 +2675,7 @@ namespace libtorrent
for (extension_list_t::iterator i = m_extensions.begin()
, end(m_extensions.end()); i != end; ++i)
{
if ((*i)->on_piece(p, data))
if ((*i)->on_piece(p, data.get()))
{
#if TORRENT_USE_ASSERTS
TORRENT_ASSERT(m_received_in_piece == p.length);