Exemple #1
0
torrent_handle session::add_torrent(add_torrent_params const& params)
{
    error_code ec;
    TORRENT_SYNC_CALL_RET2(torrent_handle, add_torrent, params, boost::ref(ec));
    if (ec) throw libtorrent_exception(ec);
    return r;
}
	TORRENT_DEPRECATED_PREFIX
	inline void TORRENT_DEPRECATED set_piece_hashes(create_torrent& t, std::wstring const& p)
	{
		error_code ec;
		set_piece_hashes(t, p, detail::nop, ec);
		if (ec) throw libtorrent_exception(ec);
	}
	TORRENT_DEPRECATED_PREFIX
	void TORRENT_DEPRECATED set_piece_hashes(create_torrent& t, std::wstring const& p, Fun f)
	{
		error_code ec;
		set_piece_hashes(t, p, f, ec);
		if (ec) throw libtorrent_exception(ec);
	}
Exemple #4
0
	torrent_handle add_magnet_uri(session& ses, std::string const& uri
		, add_torrent_params p)
	{
		error_code ec;
		torrent_handle ret = add_magnet_uri_deprecated(ses, uri, p, ec);
		if (ec) throw libtorrent_exception(ec);
		return ret;
	}
Exemple #5
0
torrent_handle add_feed_item(session& s, feed_item const& fi
	, add_torrent_params const& tp)
{
	error_code ec;
	torrent_handle ret = add_feed_item(s, fi, tp, ec);
	if (ec) throw libtorrent_exception(ec);
	return ret;
}
Exemple #6
0
//#ifndef BOOST_NO_EXCEPTIONS
	torrent_handle session::add_torrent(add_torrent_params const& params)
	{
        NS_LOG_FUNCTION(this);
		error_code ec;
        torrent_handle r = m_impl->add_torrent(params, boost::ref(ec));
		//TORRENT_SYNC_CALL_RET2(torrent_handle, add_torrent, params, boost::ref(ec));
		if (ec) throw libtorrent_exception(ec);
		return r;
	}
Exemple #7
0
	torrent_handle session::add_torrent(add_torrent_params const& params)
	{
		if (string_begins_no_case("magnet:", params.url.c_str()))
		{
			add_torrent_params p(params);
			p.url.clear();
			return add_magnet_uri(*this, params.url, p);
		}

		error_code ec;
		TORRENT_SYNC_CALL_RET2(torrent_handle, add_torrent, params, boost::ref(ec));
		if (ec) throw libtorrent_exception(ec);
		return r;
	}
Exemple #8
0
	void session::load_state(entry const& ses_state)
	{
		if (ses_state.type() == entry::undefined_t) return;
		std::vector<char> buf;
		bencode(std::back_inserter(buf), ses_state);
		lazy_entry e;
		error_code ec;
		int ret = lazy_bdecode(&buf[0], &buf[0] + buf.size(), e, ec);
		TORRENT_ASSERT(ret == 0);
#ifndef BOOST_NO_EXCEPTIONS
		if (ret != 0) throw libtorrent_exception(ec);
#endif
		TORRENT_SYNC_CALL1(load_state, &e);
	}
Exemple #9
0
	void throw_invalid_handle()
	{
		throw libtorrent_exception(error_code(
			errors::invalid_torrent_handle, libtorrent_category));
	}
Exemple #10
0
	void set_piece_hashes(create_torrent& t, std::wstring const& p, Fun f)
	{
		error_code ec;
		set_piece_hashes(t, p, f, ec);
		if (ec) throw libtorrent_exception(ec);
	}
Exemple #11
0
	inline void set_piece_hashes(create_torrent& t, std::string const& p)
	{
		error_code ec;
		set_piece_hashes(t, p, detail::nop, ec);
		if (ec) throw libtorrent_exception(ec);
	}