remove unused variables. add some comments

This commit is contained in:
Arvid Norberg 2014-11-17 03:10:00 +00:00
parent 53ba0067f9
commit 0b711f1280
3 changed files with 9 additions and 4 deletions

View File

@ -166,6 +166,7 @@ namespace libtorrent
TORRENT_EXTRA_EXPORT std::string canonicalize_path(std::string const& f);
#endif
// TODO: move this into a separate header file, TU pair
class TORRENT_EXTRA_EXPORT directory : public boost::noncopyable
{
public:

View File

@ -282,11 +282,17 @@ namespace libtorrent
return allocate_buffer_impl(l, category);
}
// we allow allocating more blocks even after we exceed the max size,
// but communicate back to the allocator (typically the peer_connection)
// that we have exceeded the limit via the out-parameter "exceeded". The
// caller is expected to honor this by not allocating any more buffers
// until the disk_observer object (passed in as "o") is invoked, indicating
// that there's more room in the pool now. This caps the amount of over-
// allocation to one block per peer connection.
char* disk_buffer_pool::allocate_buffer(bool& exceeded
, boost::shared_ptr<disk_observer> o, char const* category)
{
mutex::scoped_lock l(m_pool_mutex);
bool was_exceeded = m_exceeded_max_size;
char* ret = allocate_buffer_impl(l, category);
if (m_exceeded_max_size)
{

View File

@ -1492,7 +1492,6 @@ namespace libtorrent
{
INVARIANT_CHECK;
TORRENT_ASSERT(j->d.io.buffer_size <= m_disk_cache.block_size());
int block_size = m_disk_cache.block_size();
// should we put this write job in the cache?
// if we don't use the cache we shouldn't.
@ -1569,8 +1568,7 @@ namespace libtorrent
TORRENT_ASSERT(r.length <= m_disk_cache.block_size());
TORRENT_ASSERT(r.length <= 16 * 1024);
int block_size = m_disk_cache.block_size();
DLOG("do_read piece: %d block: %d\n", r.piece, r.start / block_size);
DLOG("do_read piece: %d block: %d\n", r.piece, r.start / m_disk_cache.block_size());
disk_io_job* j = allocate_job(disk_io_job::read);
j->storage = storage->shared_from_this();