*** empty log message ***
This commit is contained in:
parent
e801435223
commit
19abdfb14a
|
@ -267,10 +267,11 @@ the <tt class="literal"><span class="pre">session</span></tt>, it contains the m
|
|||
class session: public boost::noncopyable
|
||||
{
|
||||
|
||||
session(std::pair<int, int> listen_port_range);
|
||||
session(const fingerprint& print = libtorrent::fingerprint("LT, 0, 1, 0, 0));
|
||||
|
||||
session(
|
||||
std::pair<int, int> listen_port_range
|
||||
, const fingerprint& print
|
||||
const fingerprint& print
|
||||
, std::pair<int, int> listen_port_range
|
||||
, const char* listen_interface = 0);
|
||||
|
||||
torrent_handle add_torrent(
|
||||
|
@ -315,7 +316,11 @@ for checking, being checked or downloading) <tt class="literal"><span class="pre
|
|||
as argument. If this is ommited, the client will get a default fingerprint stating
|
||||
the version of libtorrent. The fingerprint is a short string that will be used in
|
||||
the peer-id to identify the client and the client's version. For more details see the
|
||||
fingerprint class.</p>
|
||||
fingerprint class. The constructor that only takes a finger print will not open a
|
||||
listen port for the session, to get it running you'll have to call <tt class="literal"><span class="pre">session::listen_on()</span></tt>.
|
||||
The other constructor, that takes a port range and an interface as well as the fingerprint
|
||||
will automatically try to listen on a port on the given interface. For more information about
|
||||
the parameters, see <tt class="literal"><span class="pre">listen_on()</span></tt> function.</p>
|
||||
<p><tt class="literal"><span class="pre">set_upload_rate_limit()</span></tt> set the maximum number of bytes allowed to be
|
||||
sent to peers per second. This bandwidth is distributed among all the peers. If
|
||||
you don't want to limit upload rate, you can set this to -1 (the default).
|
||||
|
@ -336,6 +341,8 @@ os will decide which interface to listen on, otherwise it should be the ip-addre
|
|||
of the interface you want the listener socket bound to. <tt class="literal"><span class="pre">listen_on()</span></tt> returns true
|
||||
if it managed to open the socket, and false if it failed. If it fails, it will also
|
||||
generate an appropriate alert (<a class="reference" href="#listen-failed-alert">listen_failed_alert</a>).</p>
|
||||
<p>The interface parameter can also be a hostname that will resolve to the device you
|
||||
want to listen on.</p>
|
||||
<p>The destructor of session will notify all trackers that our torrents has been shut down.
|
||||
If some trackers are down, they will timout. All this before the destructor of session
|
||||
returns. So, it's adviced that any kind of interface (such as windows) are closed before
|
||||
|
|
|
@ -211,10 +211,11 @@ The ``session`` class has the following synopsis::
|
|||
class session: public boost::noncopyable
|
||||
{
|
||||
|
||||
session(std::pair<int, int> listen_port_range);
|
||||
session(const fingerprint& print = libtorrent::fingerprint("LT, 0, 1, 0, 0));
|
||||
|
||||
session(
|
||||
std::pair<int, int> listen_port_range
|
||||
, const fingerprint& print
|
||||
const fingerprint& print
|
||||
, std::pair<int, int> listen_port_range
|
||||
, const char* listen_interface = 0);
|
||||
|
||||
torrent_handle add_torrent(
|
||||
|
@ -263,7 +264,11 @@ The difference between the two constructors is that one of them takes a fingerpr
|
|||
as argument. If this is ommited, the client will get a default fingerprint stating
|
||||
the version of libtorrent. The fingerprint is a short string that will be used in
|
||||
the peer-id to identify the client and the client's version. For more details see the
|
||||
fingerprint class.
|
||||
fingerprint class. The constructor that only takes a finger print will not open a
|
||||
listen port for the session, to get it running you'll have to call ``session::listen_on()``.
|
||||
The other constructor, that takes a port range and an interface as well as the fingerprint
|
||||
will automatically try to listen on a port on the given interface. For more information about
|
||||
the parameters, see ``listen_on()`` function.
|
||||
|
||||
``set_upload_rate_limit()`` set the maximum number of bytes allowed to be
|
||||
sent to peers per second. This bandwidth is distributed among all the peers. If
|
||||
|
@ -289,6 +294,9 @@ of the interface you want the listener socket bound to. ``listen_on()`` returns
|
|||
if it managed to open the socket, and false if it failed. If it fails, it will also
|
||||
generate an appropriate alert (listen_failed_alert_).
|
||||
|
||||
The interface parameter can also be a hostname that will resolve to the device you
|
||||
want to listen on.
|
||||
|
||||
The destructor of session will notify all trackers that our torrents has been shut down.
|
||||
If some trackers are down, they will timout. All this before the destructor of session
|
||||
returns. So, it's adviced that any kind of interface (such as windows) are closed before
|
||||
|
|
|
@ -241,10 +241,9 @@ int main(int argc, char* argv[])
|
|||
try
|
||||
{
|
||||
std::vector<torrent_handle> handles;
|
||||
session ses(
|
||||
std::make_pair(6881, 6889)
|
||||
, fingerprint("LT", 0, 1, 0, 0));
|
||||
session ses(fingerprint("LT", 0, 1, 0, 0));
|
||||
|
||||
ses.listen_on(std::make_pair(6881, 6889));
|
||||
ses.set_upload_rate_limit(100000);
|
||||
ses.set_http_settings(settings);
|
||||
// ses.set_severity_level(alert::debug);
|
||||
|
|
|
@ -56,7 +56,9 @@ int main(int argc, char* argv[])
|
|||
|
||||
try
|
||||
{
|
||||
session s(std::make_pair(6881, 6889));
|
||||
session s(
|
||||
libtorrent::fingerprint("LT", 0, 1, 0, 0)
|
||||
, std::make_pair(6881, 6889));
|
||||
|
||||
std::ifstream in(argv[1], std::ios_base::binary);
|
||||
in.unsetf(std::ios_base::skipws);
|
||||
|
|
|
@ -161,7 +161,7 @@ namespace libtorrent
|
|||
|
||||
session_impl(
|
||||
std::pair<int, int> listen_port_range
|
||||
, const fingerprint& cl_fprint
|
||||
, fingerprint const& cl_fprint
|
||||
, const char* listen_interface);
|
||||
|
||||
void operator()();
|
||||
|
@ -255,10 +255,10 @@ namespace libtorrent
|
|||
{
|
||||
public:
|
||||
|
||||
session(std::pair<int, int> listen_port_range);
|
||||
session(fingerprint const& print = fingerprint("LT", 0, 1, 0, 0));
|
||||
session(
|
||||
std::pair<int, int> listen_port_range
|
||||
, const fingerprint& print
|
||||
fingerprint const& print
|
||||
, std::pair<int, int> listen_port_range
|
||||
, const char* listen_interface = 0);
|
||||
|
||||
~session();
|
||||
|
|
|
@ -274,10 +274,6 @@ namespace libtorrent { namespace detail
|
|||
, m_download_rate(-1)
|
||||
, m_incoming_connection(false)
|
||||
{
|
||||
assert(listen_port_range.first > 0);
|
||||
assert(listen_port_range.first < listen_port_range.second);
|
||||
assert(m_listen_interface.port > 0);
|
||||
|
||||
// ---- generate a peer id ----
|
||||
|
||||
std::srand((unsigned int)std::time(0));
|
||||
|
@ -386,7 +382,8 @@ namespace libtorrent { namespace detail
|
|||
{
|
||||
#endif
|
||||
|
||||
open_listen_port();
|
||||
if (m_listen_port_range.first != 0 && m_listen_port_range.second != 0)
|
||||
open_listen_port();
|
||||
|
||||
std::vector<boost::shared_ptr<socket> > readable_clients;
|
||||
std::vector<boost::shared_ptr<socket> > writable_clients;
|
||||
|
@ -835,9 +832,9 @@ namespace libtorrent
|
|||
{
|
||||
|
||||
session::session(
|
||||
std::pair<int, int> listen_port_range
|
||||
, const fingerprint& id
|
||||
, const char* listen_interface)
|
||||
fingerprint const& id
|
||||
, std::pair<int, int> listen_port_range
|
||||
, char const* listen_interface)
|
||||
: m_impl(listen_port_range, id, listen_interface)
|
||||
, m_checker_impl(m_impl)
|
||||
, m_thread(boost::ref(m_impl))
|
||||
|
@ -854,14 +851,12 @@ namespace libtorrent
|
|||
#endif
|
||||
}
|
||||
|
||||
session::session(std::pair<int, int> listen_port_range)
|
||||
: m_impl(listen_port_range, fingerprint("LT",0,0,1,0))
|
||||
session::session(fingerprint const& id)
|
||||
: m_impl(std::make_pair(0, 0), id)
|
||||
, m_checker_impl(m_impl)
|
||||
, m_thread(boost::ref(m_impl))
|
||||
, m_checker_thread(boost::ref(m_checker_impl))
|
||||
{
|
||||
assert(listen_port_range.first > 0);
|
||||
assert(listen_port_range.first < listen_port_range.second);
|
||||
#ifndef NDEBUG
|
||||
boost::function0<void> test = boost::ref(m_impl);
|
||||
assert(!test.empty());
|
||||
|
|
Loading…
Reference in New Issue