Merge pull request #375 from arvidn/storage-fix

fix minor storage issues
This commit is contained in:
Arvid Norberg 2016-01-10 16:47:19 -05:00
commit d384410ea7
3 changed files with 13 additions and 11 deletions

View File

@ -2468,6 +2468,7 @@ namespace libtorrent
if (ret < 0) if (ret < 0)
{ {
TORRENT_ASSERT(j->error.ec && j->error.operation != 0);
m_disk_cache.free_buffer(static_cast<char*>(iov.iov_base)); m_disk_cache.free_buffer(static_cast<char*>(iov.iov_base));
l.lock(); l.lock();
break; break;
@ -2481,6 +2482,7 @@ namespace libtorrent
ret = -1; ret = -1;
j->error.ec.assign(boost::asio::error::eof j->error.ec.assign(boost::asio::error::eof
, boost::asio::error::get_misc_category()); , boost::asio::error::get_misc_category());
j->error.operation = storage_error::read;
m_disk_cache.free_buffer(static_cast<char*>(iov.iov_base)); m_disk_cache.free_buffer(static_cast<char*>(iov.iov_base));
l.lock(); l.lock();
break; break;

View File

@ -1520,16 +1520,16 @@ namespace libtorrent
return new default_storage(params); return new default_storage(params);
} }
int disabled_storage::readv(file::iovec_t const* int disabled_storage::readv(file::iovec_t const* bufs
, int, int, int, int, storage_error&) , int num_bufs, int, int, int, storage_error&)
{ {
return 0; return bufs_size(bufs, num_bufs);
} }
int disabled_storage::writev(file::iovec_t const* int disabled_storage::writev(file::iovec_t const* bufs
, int, int, int, int, storage_error&) , int num_bufs, int, int, int, storage_error&)
{ {
return 0; return bufs_size(bufs, num_bufs);
} }
storage_interface* disabled_storage_constructor(storage_params const& params) storage_interface* disabled_storage_constructor(storage_params const& params)

View File

@ -439,8 +439,8 @@ namespace libtorrent { namespace
if (now - seconds(60) < m_last_msg) if (now - seconds(60) < m_last_msg)
{ {
#ifndef TORRENT_DISABLE_LOGGING #ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log(peer_log_alert::info, "PEX", "waiting: %d seconds to next msg" // m_pc.peer_log(peer_log_alert::info, "PEX", "waiting: %d seconds to next msg"
, int(total_seconds(seconds(60) - (now - m_last_msg)))); // , int(total_seconds(seconds(60) - (now - m_last_msg))));
#endif #endif
return; return;
} }
@ -457,8 +457,8 @@ namespace libtorrent { namespace
if (now - milliseconds(delay) < global_last) if (now - milliseconds(delay) < global_last)
{ {
#ifndef TORRENT_DISABLE_LOGGING #ifndef TORRENT_DISABLE_LOGGING
m_pc.peer_log(peer_log_alert::info, "PEX", "global-wait: %d" // m_pc.peer_log(peer_log_alert::info, "PEX", "global-wait: %d"
, int(total_seconds(milliseconds(delay) - (now - global_last)))); // , int(total_seconds(milliseconds(delay) - (now - global_last))));
#endif #endif
return; return;
} }