added save resume action to client_test. potential small optimization in resume data save function

This commit is contained in:
Arvid Norberg 2010-03-20 22:00:13 +00:00
parent b78aca9a53
commit 786172455b
3 changed files with 28 additions and 6 deletions

View File

@ -1081,6 +1081,16 @@ int main(int argc, char* argv[])
if (h.is_valid()) h.set_sequential_download(!h.is_sequential_download());
}
if (c == 'R')
{
// save resume data for all torrents
for (handles_t::iterator i = handles.begin()
, end(handles.end()); i != end; ++i)
{
i->second.save_resume_data();
}
}
if (c == 'o')
{
torrent_handle h = get_active_torrent(handles);
@ -1181,7 +1191,7 @@ int main(int argc, char* argv[])
"[a] toggle piece bar [s] toggle download sequential [f] toggle files "
"[j] force recheck [space] toggle session pause [c] clear error [v] scrape [g] show DHT\n"
"[1] toggle IP [2] toggle AS [3] toggle timers [4] toggle block progress "
"[5] toggle peer rate [6] toggle failures [7] toggle send buffers\n";
"[5] toggle peer rate [6] toggle failures [7] toggle send buffers [R] save resume data\n";
char str[500];
int torrent_index = 0;

View File

@ -3922,10 +3922,16 @@ namespace libtorrent
{
#if TORRENT_USE_IPV6
if (addr.is_v6())
write_endpoint(tcp::endpoint(addr, p->port), banned_peers6);
{
write_address(addr, banned_peers6);
write_uint16(p->port, banned_peers6);
}
else
#endif
write_endpoint(tcp::endpoint(addr, p->port), banned_peers);
{
write_address(addr, banned_peers);
write_uint16(p->port, banned_peers);
}
continue;
}
@ -3943,10 +3949,16 @@ namespace libtorrent
#if TORRENT_USE_IPV6
if (addr.is_v6())
write_endpoint(tcp::endpoint(addr, p->port), peers6);
{
write_address(addr, peers6);
write_uint16(p->port, peers6);
}
else
#endif
write_endpoint(tcp::endpoint(addr, p->port), peers);
{
write_address(addr, peers);
write_uint16(p->port, peers);
}
}
ret["upload_rate_limit"] = upload_limit();

View File

@ -396,7 +396,7 @@ void on_udp_receive(error_code const& ec, size_t bytes_transferred, udp::endpoin
return;
}
char* ptr = buffer;
boost::uint64_t connection_id = detail::read_uint64(ptr);
detail::read_uint64(ptr);
boost::uint32_t action = detail::read_uint32(ptr);
boost::uint32_t transaction_id = detail::read_uint32(ptr);