Beispiel #1
0
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)));
}
Beispiel #2
0
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)));
}
Beispiel #3
0
/// 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);
}
Beispiel #4
0
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")
}
Beispiel #5
0
void bit::stop_torrent(const uuid& id)
{
	try {
	
	pimpl()->the_torrents_.get(id)->stop();
	
	} HAL_GENERIC_TORRENT_EXCEPTION_CATCH(id, "stop_torrent")
}
Beispiel #6
0
void bit::reannounce_torrent(const uuid& id)
{
	try {
	
	pimpl()->the_torrents_.get(id)->handle().force_reannounce();
	
	} HAL_GENERIC_TORRENT_EXCEPTION_CATCH(id, "reannounce_torrent")
}
Beispiel #7
0
void bit::unpause_all_torrents()
{	
	try {

	pimpl()->session_->resume();
	
	} HAL_GENERIC_TORRENT_EXCEPTION_CATCH(uuid(), "unpause_all_torrents")
}
Beispiel #8
0
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")
}
Beispiel #9
0
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")
}
Beispiel #10
0
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()")
}
Beispiel #11
0
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
}
Beispiel #12
0
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()")
}
Beispiel #13
0
bool bit::is_torrent(const uuid& id)
{	
	try {
	
	return pimpl()->the_torrents_.exists(id);
	
	} HAL_GENERIC_TORRENT_EXCEPTION_CATCH(id, "is_torrent")
	
	return false;
}
Beispiel #14
0
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();
 }
Beispiel #16
0
    // 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);
    }
Beispiel #17
0
    // 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);
    }
Beispiel #18
0
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")
}
Beispiel #19
0
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;
}
Beispiel #20
0
void bit::connect_torrent_completed_signal(function<void (wstring torrent_name)> fn)
{
	pimpl()->signals.torrent_completed.connect(fn);
}
Beispiel #21
0
void bit::schedual_cancel()
{
	return pimpl()->schedual_cancel();
}
Beispiel #22
0
void bit::schedual_callback(boost::posix_time::time_duration duration, action_callback_t action)
{
	return pimpl()->schedual_callback(duration, action);
}
Beispiel #23
0
void bit::schedual_callback(boost::posix_time::ptime time, action_callback_t action)
{
	return pimpl()->schedual_callback(time, action);
}
Beispiel #24
0
void bit::schedual_action(boost::posix_time::time_duration duration, timeout_actions action)
{
	return pimpl()->schedual_action(duration, action);
}
Beispiel #25
0
void bit::close_all(boost::optional<report_num_active> fn)
{
	pimpl()->close_all(fn);
}
Beispiel #26
0
void bit::remove_torrent_wipe_files(const uuid& id, remove_files f)
{
	pimpl()->remove_torrent_wipe_files(id, f);
}
Beispiel #27
0
void bit::remove_torrent(const uuid& id)
{
	pimpl()->remove_torrent(id);
}
Beispiel #28
0
void bit::resume_all()
{
	pimpl()->resume_all();
}
Beispiel #29
0
void bit::schedual_action(boost::posix_time::ptime time, timeout_actions action)
{
	return pimpl()->schedual_action(time, action);
}
Beispiel #30
0
const cache_details bit::get_cache_details() const
{
	return pimpl()->get_cache_details();
}