Merge branch 'RC_1_1'

This commit is contained in:
arvidn 2016-02-12 15:43:13 -05:00
commit 3842a0a197
10 changed files with 50 additions and 36 deletions

View File

@ -468,21 +468,22 @@ The file format is a bencoded dictionary containing the following fields:
| | especially useful when moving torrents with move_storage() | | | especially useful when moving torrents with move_storage() |
| | since this will be updated. | | | since this will be updated. |
+--------------------------+--------------------------------------------------------------+ +--------------------------+--------------------------------------------------------------+
| ``peers`` | list of dictionaries. Each dictionary has the following | | ``peers`` | string. This string contains IPv4 and port pairs of peers we |
| | layout: | | | were connected to last session. The endpoints are in compact |
| | | | | representation. 4 bytes IPv4 address followed by 2 bytes |
| | +----------+-----------------------------------------------+ | | | port. Hence, the length of this string should be divisible |
| | | ``ip`` | string, the ip address of the peer. This is | | | | by 6. |
| | | | not a binary representation of the ip | | +--------------------------+--------------------------------------------------------------+
| | | | address, but the string representation. It | | | ``banned_peers`` | string. This string has the same format as ``peers`` but |
| | | | may be an IPv6 string or an IPv4 string. | | | | instead represent IPv4 peers that we have banned. |
| | +----------+-----------------------------------------------+ | +--------------------------+--------------------------------------------------------------+
| | | ``port`` | integer, the listen port of the peer | | | ``peers6`` | string. This string contains IPv6 and port pairs of peers we |
| | +----------+-----------------------------------------------+ | | | were connected to last session. The endpoints are in compact |
| | | | | representation. 16 bytes IPv6 address followed by 2 bytes |
| | These are the local peers we were connected to when this | | | port. The length of this string should be divisible by 18. |
| | fast-resume data was saved. | +--------------------------+--------------------------------------------------------------+
| | | | ``banned_peers6`` | string. This string has the same format as ``peers6`` but |
| | instead represent IPv6 peers that we have banned. |
+--------------------------+--------------------------------------------------------------+ +--------------------------+--------------------------------------------------------------+
| ``unfinished`` | list of dictionaries. Each dictionary represents an | | ``unfinished`` | list of dictionaries. Each dictionary represents an |
| | piece, and has the following layout: | | | piece, and has the following layout: |

View File

@ -2009,14 +2009,14 @@ namespace libtorrent
// the sequence number of this item // the sequence number of this item
boost::uint64_t seq; boost::uint64_t seq;
// the salf, if any, used to lookup and store this item. If no // the salt, if any, used to lookup and store this item. If no
// salt was used, this is an empty string // salt was used, this is an empty string
std::string salt; std::string salt;
// the data for this item // the data for this item
entry item; entry item;
// the last response for mutable date is authoritative. // the last response for mutable data is authoritative.
bool authoritative; bool authoritative;
}; };

View File

@ -115,6 +115,7 @@ namespace dht
virtual bool get_peers(sha1_hash const& info_hash virtual bool get_peers(sha1_hash const& info_hash
, bool noseed, bool scrape , bool noseed, bool scrape
, entry& peers) const = 0; , entry& peers) const = 0;
// This function is named announce_peer for consistency with the // This function is named announce_peer for consistency with the
// upper layers, but has nothing to do with networking. Its only // upper layers, but has nothing to do with networking. Its only
// responsibility is store the peer in such a way that it's returned // responsibility is store the peer in such a way that it's returned
@ -139,6 +140,7 @@ namespace dht
// //
virtual bool get_immutable_item(sha1_hash const& target virtual bool get_immutable_item(sha1_hash const& target
, entry& item) const = 0; , entry& item) const = 0;
// Store the item's data. This layer is only for storage. // Store the item's data. This layer is only for storage.
// The authentication of the item is performed by the upper layer. // The authentication of the item is performed by the upper layer.
// //
@ -158,6 +160,7 @@ namespace dht
// //
virtual bool get_mutable_item_seq(sha1_hash const& target virtual bool get_mutable_item_seq(sha1_hash const& target
, boost::int64_t& seq) const = 0; , boost::int64_t& seq) const = 0;
// This function retrieves the mutable stored in the DHT. // This function retrieves the mutable stored in the DHT.
// //
// For implementers: // For implementers:
@ -166,7 +169,7 @@ namespace dht
// the following keys should be filled // the following keys should be filled
// item["v"] - with the value no encoded. // item["v"] - with the value no encoded.
// item["sig"] - with a string representation of the signature. // item["sig"] - with a string representation of the signature.
// item["k"] - with a string represnetation of the public key. // item["k"] - with a string representation of the public key.
// //
// returns true if the item is found and the data is returned // returns true if the item is found and the data is returned
// inside the (entry) out parameter item. // inside the (entry) out parameter item.
@ -174,6 +177,7 @@ namespace dht
virtual bool get_mutable_item(sha1_hash const& target virtual bool get_mutable_item(sha1_hash const& target
, boost::int64_t seq, bool force_fill , boost::int64_t seq, bool force_fill
, entry& item) const = 0; , entry& item) const = 0;
// Store the item's data. This layer is only for storage. // Store the item's data. This layer is only for storage.
// The authentication of the item is performed by the upper layer. // The authentication of the item is performed by the upper layer.
// //

View File

@ -263,7 +263,7 @@ namespace libtorrent
// it to finish. The timeout can be set with apply_settings(). // it to finish. The timeout can be set with apply_settings().
~session(); ~session();
// In case you want to destruct the session asynchrounously, you can // In case you want to destruct the session asynchronously, you can
// request a session destruction proxy. If you don't do this, the // request a session destruction proxy. If you don't do this, the
// destructor of the session object will block while the trackers are // destructor of the session object will block while the trackers are
// contacted. If you keep one ``session_proxy`` to the session when // contacted. If you keep one ``session_proxy`` to the session when

View File

@ -178,10 +178,10 @@ namespace libtorrent
// to allow accepting uTP connections as well as TCP. If using the DHT, // to allow accepting uTP connections as well as TCP. If using the DHT,
// this will also make the DHT use the same UDP ports. // this will also make the DHT use the same UDP ports.
// //
// Note:: // .. note::
// The current support for opening arbitrary UDP sockets is limited. // The current support for opening arbitrary UDP sockets is limited.
// In this version of libtorrent, there will only ever be two UDP // In this version of libtorrent, there will only ever be two UDP
// sockets, one for IPv4 and one for IPv6. // sockets, one for IPv4 and one for IPv6.
listen_interfaces, listen_interfaces,
// when using a poxy, this is the hostname where the proxy is running // when using a poxy, this is the hostname where the proxy is running

View File

@ -984,7 +984,7 @@ namespace libtorrent
// string containing one or more, comma separated, ip-address (either an // string containing one or more, comma separated, ip-address (either an
// IPv4 or IPv6 address). When specifying multiple interfaces, the // IPv4 or IPv6 address). When specifying multiple interfaces, the
// torrent will round-robin which interface to use for each outgoing // torrent will round-robin which interface to use for each outgoing
// conneciton. This is useful for clients that are multi-homed. // connection. This is useful for clients that are multi-homed.
void use_interface(const char* net_interface) const; void use_interface(const char* net_interface) const;
// Fills the specified ``std::vector<int>`` with the availability for // Fills the specified ``std::vector<int>`` with the availability for
@ -993,17 +993,17 @@ namespace libtorrent
// for all pieces is reported as 0. // for all pieces is reported as 0.
// //
// The piece availability is the number of peers that we are connected // The piece availability is the number of peers that we are connected
// that has advertized having a particular piece. This is the information // that has advertised having a particular piece. This is the information
// that libtorrent uses in order to prefer picking rare pieces. // that libtorrent uses in order to prefer picking rare pieces.
void piece_availability(std::vector<int>& avail) const; void piece_availability(std::vector<int>& avail) const;
// These functions are used to set and get the prioritiy of individual // These functions are used to set and get the priority of individual
// pieces. By default all pieces have priority 4. That means that the // pieces. By default all pieces have priority 4. That means that the
// random rarest first algorithm is effectively active for all pieces. // random rarest first algorithm is effectively active for all pieces.
// You may however change the priority of individual pieces. There are 8 // You may however change the priority of individual pieces. There are 8
// priority levels. 0 means not to download the piece at all. Otherwise, // priority levels. 0 means not to download the piece at all. Otherwise,
// lower priority values means less likely to be picked. Piece priority // lower priority values means less likely to be picked. Piece priority
// takes presedence over piece availability. Every priority-7 piece will // takes precedence over piece availability. Every priority-7 piece will
// be attempted to be picked before a priority 6 piece and so on. // be attempted to be picked before a priority 6 piece and so on.
// //
// Piece priorities can not be changed for torrents that have not // Piece priorities can not be changed for torrents that have not

View File

@ -288,8 +288,8 @@ namespace libtorrent
// ``set_web_seeds()`` replaces all web seeds with the ones specified in // ``set_web_seeds()`` replaces all web seeds with the ones specified in
// the ``seeds`` vector. // the ``seeds`` vector.
// //
// The ``extern_auth`` argument can be used for other athorization // The ``extern_auth`` argument can be used for other authorization
// schemese than basic HTTP authorization. If set, it will override any // schemes than basic HTTP authorization. If set, it will override any
// username and password found in the URL itself. The string will be sent // username and password found in the URL itself. The string will be sent
// as the HTTP authorization header's value (without specifying "Basic"). // as the HTTP authorization header's value (without specifying "Basic").
// //

View File

@ -278,7 +278,9 @@ int _System __libsocket_sysctl(int* mib, u_int namelen, void *oldp, size_t *oldl
ifreq req; ifreq req;
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
if_indextoname(rtm->rtm_index, req.ifr_name); if_indextoname(rtm->rtm_index, req.ifr_name);
if (ioctl(s, siocgifmtu, &req) < 0) return false;
// ignore errors here. This is best-effort
ioctl(s, siocgifmtu, &req);
rt_info->mtu = req.ifr_mtu; rt_info->mtu = req.ifr_mtu;
return true; return true;
@ -465,10 +467,9 @@ namespace libtorrent
memset(&req, 0, sizeof(req)); memset(&req, 0, sizeof(req));
// -1 to leave a null terminator // -1 to leave a null terminator
strncpy(req.ifr_name, iface.name, IF_NAMESIZE - 1); strncpy(req.ifr_name, iface.name, IF_NAMESIZE - 1);
if (ioctl(s, siocgifmtu, &req) < 0)
{ // ignore errors here. This is best-effort
continue; ioctl(s, siocgifmtu, &req);
}
iface.mtu = req.ifr_mtu; iface.mtu = req.ifr_mtu;
ret.push_back(iface); ret.push_back(iface);
} }

View File

@ -1928,6 +1928,11 @@ retry:
if (!ec && s.sock) if (!ec && s.sock)
{ {
// update the listen_interface member with the
// actual port we ended up listening on, so that the other
// sockets can be bound to the same one
m_listen_interface.port(s.external_port);
TORRENT_ASSERT(!m_abort); TORRENT_ASSERT(!m_abort);
m_listen_sockets.push_back(s); m_listen_sockets.push_back(s);

View File

@ -209,6 +209,9 @@ void test_ssl(int test_idx, bool use_utp)
ses2.status(); ses2.status();
} }
wait_for_alert(ses1, torrent_finished_alert::alert_type, "ses1");
wait_for_downloading(ses2, "ses2");
// connect the peers after setting the certificates // connect the peers after setting the certificates
int port = 0; int port = 0;
if (test.use_ssl_ports) if (test.use_ssl_ports)
@ -219,7 +222,7 @@ void test_ssl(int test_idx, bool use_utp)
else else
port = ses2.listen_port(); port = ses2.listen_port();
fprintf(stderr, "%s: ses1: connecting peer port: %d\n" fprintf(stderr, "\n\n%s: ses1: connecting peer port: %d\n\n\n"
, time_now_string(), port); , time_now_string(), port);
tor1.connect_peer(tcp::endpoint(address::from_string("127.0.0.1", ec) tor1.connect_peer(tcp::endpoint(address::from_string("127.0.0.1", ec)
, port)); , port));
@ -263,7 +266,7 @@ void test_ssl(int test_idx, bool use_utp)
if (st2.state != torrent_status::downloading) if (st2.state != torrent_status::downloading)
{ {
static char const* state_str[] = static char const* state_str[] =
{"checking (q)", "checking", "dl metadata" {"checking (q)", "checking", "dl metadata"
, "downloading", "finished", "seeding", "allocating", "checking (r)"}; , "downloading", "finished", "seeding", "allocating", "checking (r)"};
std::cerr << "st2 state: " << state_str[st2.state] << std::endl; std::cerr << "st2 state: " << state_str[st2.state] << std::endl;