void bit::set_session_half_open_limit(int halfConn) { libt::session_settings s = pimpl()->session_->settings(); s.half_open_limit = halfConn; pimpl()->session_->set_settings(s); event_log().post(shared_ptr<EventDetail>(new EventMsg( hal::wform(L"Set half-open connections limit to %1%.") % s.half_open_limit))); }
void bit::set_torrent_defaults(const connections& defaults) { pimpl()->default_torrent_max_connections_ = defaults.total; pimpl()->default_torrent_max_uploads_ = defaults.uploads; event_log().post(shared_ptr<EventDetail>(new EventMsg( hal::wform(L"Set torrent connections total %1% and uploads %2%.") % defaults.total % defaults.uploads))); pimpl()->default_torrent_download_ = defaults.download_rate; pimpl()->default_torrent_upload_ = defaults.upload_rate; event_log().post(shared_ptr<EventDetail>(new EventMsg( hal::wform(L"Set torrent default rates at %1$.2fkb/s down and %2$.2fkb/s upload.") % defaults.download_rate % defaults.upload_rate))); }
/// Matches the regular expression against a string. /// /// \param str String to match the regular expression against. /// /// \return A new regex_matches object with the results of the match. text::regex_matches text::regex::match(const std::string& str) const { std::shared_ptr< regex_matches::impl > pimpl(new regex_matches::impl( &_pimpl->_preg, str, _pimpl->_ngroups)); return regex_matches(pimpl); }
void bit::get_all_file_details(const uuid& id, file_details_vec& file_details) { try { pimpl()->the_torrents_.get(id)->get_file_details(file_details); } HAL_GENERIC_TORRENT_EXCEPTION_CATCH(id, "get_all_file_details") }
void bit::stop_torrent(const uuid& id) { try { pimpl()->the_torrents_.get(id)->stop(); } HAL_GENERIC_TORRENT_EXCEPTION_CATCH(id, "stop_torrent") }
void bit::reannounce_torrent(const uuid& id) { try { pimpl()->the_torrents_.get(id)->handle().force_reannounce(); } HAL_GENERIC_TORRENT_EXCEPTION_CATCH(id, "reannounce_torrent") }
void bit::unpause_all_torrents() { try { pimpl()->session_->resume(); } HAL_GENERIC_TORRENT_EXCEPTION_CATCH(uuid(), "unpause_all_torrents") }
void bit::get_all_peer_details(const uuid& id, peer_details_vec& peer_container) { try { pimpl()->the_torrents_.get(id)->get_peer_details(peer_container); } HAL_GENERIC_TORRENT_EXCEPTION_CATCH(id, "get_all_peer_details") }
void bit::recheck_torrent(const uuid& id) { try { // pimpl()->the_torrents_.get(filename)->output_torrent_debug_details(); pimpl()->the_torrents_.get(id)->force_recheck(); } HAL_GENERIC_TORRENT_EXCEPTION_CATCH(id, "recheck_torrent") }
void bit::start_event_receiver() { try { pimpl()->start_alert_handler(); event_log().post(shared_ptr<EventDetail>(new EventMsg(L" ... started handler"))); } HAL_GENERIC_PIMPL_EXCEPTION_CATCH("bit::start_event_receiver()") }
bool bit::is_torrent_active(const uuid& id) { try { return pimpl()->the_torrents_.get(id)->is_active(); } HAL_GENERIC_TORRENT_EXCEPTION_CATCH(id, "is_torrent_active") return false; // ??? is this correct }
void bit::stop_event_receiver() { try { event_log().post(shared_ptr<EventDetail>(new EventMsg(L"Stopping event handler"))); pimpl()->stop_alert_handler(); } HAL_GENERIC_PIMPL_EXCEPTION_CATCH("bit::stop_event_receiver()") }
bool bit::is_torrent(const uuid& id) { try { return pimpl()->the_torrents_.exists(id); } HAL_GENERIC_TORRENT_EXCEPTION_CATCH(id, "is_torrent") return false; }
bool bit::is_any_torrent_active() { bool result = false; try { for (torrent_manager::torrent_by_name::iterator i=pimpl()->the_torrents_.begin(), e=pimpl()->the_torrents_.end(); i != e; ++i) { if ((*i).torrent->is_active()) { result = true; break; } } } HAL_GENERIC_TORRENT_EXCEPTION_CATCH(uuid(), "is_any_torrent_active") return result; }
static PimplCollection::iterator Find(PimplCollection& pimpls, const std::string& string) { PimplCollection::iterator it = pimpls.begin(); while(it != pimpls.end()) { PimplCollection::iterator f(it++); Private::String& pimpl(*f); if(pimpl.string == string) return f; } return pimpls.end(); }
// foreign_create_window window foreign_create_window(void * win) { // create impl_type boost::shared_ptr<window::impl_type> pimpl(new window::impl_type()); // create window pimpl->win = khaos::foreign_create_window(win); // create/set event handler pimpl->win->handler = detail::event_handler(window(pimpl), pimpl); return window(pimpl); }
// create_child_window window create_child_window(int x, int y, int cx, int cy, window const& parent) { // create impl_type boost::shared_ptr<window::impl_type> pimpl(new window::impl_type()); // create window pimpl->win = khaos::create_child_window(x, y, cx, cy, parent.khaos_window()); // create/set event handler pimpl->win->handler = detail::event_handler(window(pimpl), pimpl); return window(pimpl); }
void bit::update_torrent_details_manager_thread(const uuid& focused, const std::set<uuid>& selected) { try { torrent_details_map tmp_map; for (torrent_manager::torrent_by_name::iterator i=pimpl()->the_torrents_.begin(), e=pimpl()->the_torrents_.end(); i != e; ++i) { torrent_details_ptr pT = (*i).torrent->get_torrent_details_ptr(); tmp_map[(*i).torrent->id()] = pT; } { unique_lock_t l(torrent_details_.mutex_); torrent_details_.focused_ = focused; torrent_details_.selected_names_ = selected; std::swap(tmp_map, torrent_details_.torrent_map_); } } HAL_GENERIC_TORRENT_EXCEPTION_CATCH(uuid(), "updatetorrent_details_manager") }
const SessionDetail bit::get_session_details() { SessionDetail details; details.port = pimpl()->session_->is_listening() ? pimpl()->session_->listen_port() : -1; libt::session_status status = pimpl()->session_->status(); details.speed = std::make_pair(status.download_rate, status.upload_rate); details.dht_on = pimpl()->dht_on_; details.dht_nodes = status.dht_nodes; details.dht_torrents = status.dht_torrents; details.ip_filter_on = pimpl()->ip_filter_on_; details.ip_ranges_filtered = pimpl()->ip_filter_count_; return details; }
void bit::connect_torrent_completed_signal(function<void (wstring torrent_name)> fn) { pimpl()->signals.torrent_completed.connect(fn); }
void bit::schedual_cancel() { return pimpl()->schedual_cancel(); }
void bit::schedual_callback(boost::posix_time::time_duration duration, action_callback_t action) { return pimpl()->schedual_callback(duration, action); }
void bit::schedual_callback(boost::posix_time::ptime time, action_callback_t action) { return pimpl()->schedual_callback(time, action); }
void bit::schedual_action(boost::posix_time::time_duration duration, timeout_actions action) { return pimpl()->schedual_action(duration, action); }
void bit::close_all(boost::optional<report_num_active> fn) { pimpl()->close_all(fn); }
void bit::remove_torrent_wipe_files(const uuid& id, remove_files f) { pimpl()->remove_torrent_wipe_files(id, f); }
void bit::remove_torrent(const uuid& id) { pimpl()->remove_torrent(id); }
void bit::resume_all() { pimpl()->resume_all(); }
void bit::schedual_action(boost::posix_time::ptime time, timeout_actions action) { return pimpl()->schedual_action(time, action); }
const cache_details bit::get_cache_details() const { return pimpl()->get_cache_details(); }