all functions on torrent_handle are now const. restored r, p, u keys in client_test

This commit is contained in:
Arvid Norberg 2005-10-19 13:58:41 +00:00
parent 4f295074c6
commit 55144fc3f4
3 changed files with 44 additions and 39 deletions

View File

@ -625,27 +625,27 @@ int main(int ac, char* av[])
if(c == 'r')
{
/* // force reannounce on all torrents
// force reannounce on all torrents
std::for_each(handles.begin(), handles.end()
, bind(&torrent_handle::force_reannounce
, bind(&handles_t::value_type::first, _1)));
*/ }
, bind(&handles_t::value_type::second, _1)));
}
if(c == 'p')
{
/* // pause all torrents
// pause all torrents
std::for_each(handles.begin(), handles.end()
, bind(&torrent_handle::pause
, bind(&handles_t::value_type::first, _1)));
*/ }
, bind(&handles_t::value_type::second, _1)));
}
if(c == 'u')
{
/* // unpause all torrents
// unpause all torrents
std::for_each(handles.begin(), handles.end()
, bind(&torrent_handle::resume
, bind(&handles_t::value_type::first, _1)));
*/ }
, bind(&handles_t::value_type::second, _1)));
}
if (c == 'i') print_peers = !print_peers;
if (c == 'l') print_log = !print_log;

View File

@ -213,7 +213,7 @@ namespace libtorrent
void get_download_queue(std::vector<partial_piece_info>& queue) const;
std::vector<announce_entry> const& trackers() const;
void replace_trackers(std::vector<announce_entry> const&);
void replace_trackers(std::vector<announce_entry> const&) const;
bool has_metadata() const;
const torrent_info& get_torrent_info() const;
@ -221,14 +221,14 @@ namespace libtorrent
bool is_seed() const;
bool is_paused() const;
void pause();
void resume();
void pause() const;
void resume() const;
// marks the piece with the given index as filtered
// it will not be downloaded
void filter_piece(int index, bool filter);
void filter_pieces(std::vector<bool> const& pieces);
void filter_piece(int index, bool filter) const;
void filter_pieces(std::vector<bool> const& pieces) const;
bool is_piece_filtered(int index) const;
std::vector<bool> filtered_pieces() const;
@ -236,12 +236,12 @@ namespace libtorrent
//todo refactoring and improving the function body
// marks the file with the given index as filtered
// it will not be downloaded
void filter_file(int index, bool filter);
void filter_files(std::vector<bool> const& files);
void filter_file(int index, bool filter) const;
void filter_files(std::vector<bool> const& files) const;
// set the interface to bind outgoing connections
// to.
void use_interface(const char* net_interface);
void use_interface(const char* net_interface) const;
entry write_resume_data() const;
@ -266,15 +266,15 @@ namespace libtorrent
// to finish all pieces currently in the pipeline, and then
// abort the torrent.
void set_upload_limit(int limit);
void set_download_limit(int limit);
void set_upload_limit(int limit) const;
void set_download_limit(int limit) const;
// manually connect a peer
void connect_peer(address const& adr) const;
// valid ratios are 0 (infinite ratio) or [ 1.0 , inf )
// the ratio is uploaded / downloaded. less than 1 is not allowed
void set_ratio(float up_down_ratio);
void set_ratio(float up_down_ratio) const;
// TODO: add finish_file_allocation, which will force the
// torrent to allocate storage for all pieces.
@ -282,15 +282,16 @@ namespace libtorrent
boost::filesystem::path save_path() const;
// -1 means unlimited unchokes
void set_max_uploads(int max_uploads);
void set_max_uploads(int max_uploads) const;
// -1 means unlimited connections
void set_max_connections(int max_connections);
void set_max_connections(int max_connections) const;
void set_tracker_login(std::string const& name, std::string const& password);
void set_tracker_login(std::string const& name
, std::string const& password) const;
// post condition: save_path() == save_path if true is returned
bool move_storage(boost::filesystem::path const& save_path);
bool move_storage(boost::filesystem::path const& save_path) const;
const sha1_hash& info_hash() const
{ return m_info_hash; }

View File

@ -116,7 +116,7 @@ namespace libtorrent
#endif
void torrent_handle::set_max_uploads(int max_uploads)
void torrent_handle::set_max_uploads(int max_uploads) const
{
INVARIANT_CHECK;
@ -126,7 +126,7 @@ namespace libtorrent
, bind(&torrent::set_max_uploads, _1, max_uploads));
}
void torrent_handle::use_interface(const char* net_interface)
void torrent_handle::use_interface(const char* net_interface) const
{
INVARIANT_CHECK;
@ -134,7 +134,7 @@ namespace libtorrent
, bind(&torrent::use_interface, _1, net_interface));
}
void torrent_handle::set_max_connections(int max_connections)
void torrent_handle::set_max_connections(int max_connections) const
{
INVARIANT_CHECK;
@ -144,7 +144,7 @@ namespace libtorrent
, bind(&torrent::set_max_connections, _1, max_connections));
}
void torrent_handle::set_upload_limit(int limit)
void torrent_handle::set_upload_limit(int limit) const
{
INVARIANT_CHECK;
@ -154,7 +154,7 @@ namespace libtorrent
, bind(&torrent::set_upload_limit, _1, limit));
}
void torrent_handle::set_download_limit(int limit)
void torrent_handle::set_download_limit(int limit) const
{
INVARIANT_CHECK;
@ -164,7 +164,8 @@ namespace libtorrent
, bind(&torrent::set_download_limit, _1, limit));
}
bool torrent_handle::move_storage(boost::filesystem::path const& save_path)
bool torrent_handle::move_storage(
boost::filesystem::path const& save_path) const
{
INVARIANT_CHECK;
@ -196,7 +197,7 @@ namespace libtorrent
, bind(&torrent::is_paused, _1));
}
void torrent_handle::pause()
void torrent_handle::pause() const
{
INVARIANT_CHECK;
@ -204,7 +205,7 @@ namespace libtorrent
, bind(&torrent::pause, _1));
}
void torrent_handle::resume()
void torrent_handle::resume() const
{
INVARIANT_CHECK;
@ -212,7 +213,8 @@ namespace libtorrent
, bind(&torrent::resume, _1));
}
void torrent_handle::set_tracker_login(std::string const& name, std::string const& password)
void torrent_handle::set_tracker_login(std::string const& name
, std::string const& password) const
{
INVARIANT_CHECK;
@ -261,14 +263,14 @@ namespace libtorrent
return torrent_status();
}
void torrent_handle::filter_piece(int index, bool filter)
void torrent_handle::filter_piece(int index, bool filter) const
{
INVARIANT_CHECK;
call_member<void>(m_ses, m_chk, m_info_hash
, bind(&torrent::filter_piece, _1, index, filter));
}
void torrent_handle::filter_pieces(std::vector<bool> const& pieces)
void torrent_handle::filter_pieces(std::vector<bool> const& pieces) const
{
INVARIANT_CHECK;
call_member<void>(m_ses, m_chk, m_info_hash
@ -291,14 +293,14 @@ namespace libtorrent
return ret;
}
void torrent_handle::filter_file(int index, bool filter)
void torrent_handle::filter_file(int index, bool filter) const
{
INVARIANT_CHECK;
call_member<void>(m_ses, m_chk, m_info_hash
, bind(&torrent::filter_file, _1, index, filter));
}
void torrent_handle::filter_files(std::vector<bool> const& files)
void torrent_handle::filter_files(std::vector<bool> const& files) const
{
INVARIANT_CHECK;
call_member<void>(m_ses, m_chk, m_info_hash
@ -313,7 +315,8 @@ namespace libtorrent
, m_chk, m_info_hash, bind(&torrent::trackers, _1));
}
void torrent_handle::replace_trackers(std::vector<announce_entry> const& urls)
void torrent_handle::replace_trackers(
std::vector<announce_entry> const& urls) const
{
INVARIANT_CHECK;
@ -532,7 +535,7 @@ namespace libtorrent
t->force_tracker_request();
}
void torrent_handle::set_ratio(float ratio)
void torrent_handle::set_ratio(float ratio) const
{
INVARIANT_CHECK;
@ -694,3 +697,4 @@ namespace libtorrent
}
}