| escape_string.hpp | | escape_string.hpp | |
| | | | |
| skipping to change at line 56 | | skipping to change at line 56 | |
| | | | |
| TORRENT_EXTRA_EXPORT std::string unescape_string(std::string const&
s, error_code& ec); | | TORRENT_EXTRA_EXPORT std::string unescape_string(std::string const&
s, error_code& ec); | |
| // replaces all disallowed URL characters by their %-encoding | | // replaces all disallowed URL characters by their %-encoding | |
| TORRENT_EXTRA_EXPORT std::string escape_string(const char* str, int
len); | | TORRENT_EXTRA_EXPORT std::string escape_string(const char* str, int
len); | |
| // same as escape_string but does not encode '/' | | // same as escape_string but does not encode '/' | |
| TORRENT_EXTRA_EXPORT std::string escape_path(const char* str, int le
n); | | TORRENT_EXTRA_EXPORT std::string escape_path(const char* str, int le
n); | |
| // if the url does not appear to be encoded, and it contains illegal
url characters | | // if the url does not appear to be encoded, and it contains illegal
url characters | |
| // it will be encoded | | // it will be encoded | |
| TORRENT_EXTRA_EXPORT std::string maybe_url_encode(std::string const&
url); | | TORRENT_EXTRA_EXPORT std::string maybe_url_encode(std::string const&
url); | |
| | | | |
|
| | | // returns true if the given string (not null terminated) contains | |
| | | // characters that would need to be escaped if used in a URL | |
| TORRENT_EXTRA_EXPORT bool need_encoding(char const* str, int len); | | TORRENT_EXTRA_EXPORT bool need_encoding(char const* str, int len); | |
| | | | |
| // encodes a string using the base64 scheme | | // encodes a string using the base64 scheme | |
| TORRENT_EXTRA_EXPORT std::string base64encode(std::string const& s); | | TORRENT_EXTRA_EXPORT std::string base64encode(std::string const& s); | |
| TORRENT_EXTRA_EXPORT std::string base64decode(std::string const& s); | | TORRENT_EXTRA_EXPORT std::string base64decode(std::string const& s); | |
| // encodes a string using the base32 scheme | | // encodes a string using the base32 scheme | |
| TORRENT_EXTRA_EXPORT std::string base32encode(std::string const& s); | | TORRENT_EXTRA_EXPORT std::string base32encode(std::string const& s); | |
| TORRENT_EXTRA_EXPORT std::string base32decode(std::string const& s); | | TORRENT_EXTRA_EXPORT std::string base32decode(std::string const& s); | |
| | | | |
| TORRENT_EXTRA_EXPORT std::string url_has_argument( | | TORRENT_EXTRA_EXPORT std::string url_has_argument( | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 2 lines changed or added | |
|
| routing_table.hpp | | routing_table.hpp | |
| | | | |
| skipping to change at line 88 | | skipping to change at line 88 | |
| // * Nodes are not marked as being stale, they keep a counter | | // * Nodes are not marked as being stale, they keep a counter | |
| // that tells how many times in a row they have failed. When | | // that tells how many times in a row they have failed. When | |
| // a new node is to be inserted, the node that has failed | | // a new node is to be inserted, the node that has failed | |
| // the most times is replaced. If none of the nodes in the | | // the most times is replaced. If none of the nodes in the | |
| // bucket has failed, then it is put in the replacement | | // bucket has failed, then it is put in the replacement | |
| // cache (just like in the paper). | | // cache (just like in the paper). | |
| | | | |
| class TORRENT_EXTRA_EXPORT routing_table | | class TORRENT_EXTRA_EXPORT routing_table | |
| { | | { | |
| public: | | public: | |
|
| | | typedef std::vector<routing_table_node> table_t; | |
| | | | |
| routing_table(node_id const& id, int bucket_size | | routing_table(node_id const& id, int bucket_size | |
| , dht_settings const& settings); | | , dht_settings const& settings); | |
| | | | |
| void status(session_status& s) const; | | void status(session_status& s) const; | |
| | | | |
| void node_failed(node_id const& id, udp::endpoint const& ep); | | void node_failed(node_id const& id, udp::endpoint const& ep); | |
| | | | |
| // adds an endpoint that will never be added to | | // adds an endpoint that will never be added to | |
| // the routing table | | // the routing table | |
| void add_router_node(udp::endpoint router); | | void add_router_node(udp::endpoint router); | |
| | | | |
| skipping to change at line 130 | | skipping to change at line 132 | |
| bool need_refresh(node_id& target) const; | | bool need_refresh(node_id& target) const; | |
| | | | |
| enum | | enum | |
| { | | { | |
| include_failed = 1 | | include_failed = 1 | |
| }; | | }; | |
| // fills the vector with the count nodes from our buckets that | | // fills the vector with the count nodes from our buckets that | |
| // are nearest to the given id. | | // are nearest to the given id. | |
| void find_node(node_id const& id, std::vector<node_entry>& l | | void find_node(node_id const& id, std::vector<node_entry>& l | |
| , int options, int count = 0); | | , int options, int count = 0); | |
|
| | | void remove_node(node_entry* n | |
| | | , table_t::iterator bucket) ; | |
| | | | |
| int bucket_size(int bucket) | | int bucket_size(int bucket) | |
| { | | { | |
| int num_buckets = m_buckets.size(); | | int num_buckets = m_buckets.size(); | |
| if (num_buckets == 0) return 0; | | if (num_buckets == 0) return 0; | |
| if (bucket < num_buckets) bucket = num_buckets - 1; | | if (bucket < num_buckets) bucket = num_buckets - 1; | |
| table_t::iterator i = m_buckets.begin(); | | table_t::iterator i = m_buckets.begin(); | |
| std::advance(i, bucket); | | std::advance(i, bucket); | |
| return (int)i->live_nodes.size(); | | return (int)i->live_nodes.size(); | |
| } | | } | |
| | | | |
| skipping to change at line 166 | | skipping to change at line 170 | |
| #if defined TORRENT_DHT_VERBOSE_LOGGING || defined TORRENT_DEBUG | | #if defined TORRENT_DHT_VERBOSE_LOGGING || defined TORRENT_DEBUG | |
| // used for debug and monitoring purposes. This will print out | | // used for debug and monitoring purposes. This will print out | |
| // the state of the routing table to the given stream | | // the state of the routing table to the given stream | |
| void print_state(std::ostream& os) const; | | void print_state(std::ostream& os) const; | |
| #endif | | #endif | |
| | | | |
| void touch_bucket(node_id const& target); | | void touch_bucket(node_id const& target); | |
| | | | |
| private: | | private: | |
| | | | |
|
| typedef std::list<routing_table_node> table_t; | | | |
| | | | |
| table_t::iterator find_bucket(node_id const& id); | | table_t::iterator find_bucket(node_id const& id); | |
| | | | |
| // return a pointer the node_entry with the given endpoint | | // return a pointer the node_entry with the given endpoint | |
| // or 0 if we don't have such a node. Both the address and the | | // or 0 if we don't have such a node. Both the address and the | |
| // port has to match | | // port has to match | |
| node_entry* find_node(udp::endpoint const& ep, routing_table::table_
t::iterator* bucket); | | node_entry* find_node(udp::endpoint const& ep, routing_table::table_
t::iterator* bucket); | |
| | | | |
| // constant called k in paper | | // constant called k in paper | |
| int m_bucket_size; | | int m_bucket_size; | |
| | | | |
| | | | |
| skipping to change at line 212 | | skipping to change at line 214 | |
| // this is a set of all the endpoints that have | | // this is a set of all the endpoints that have | |
| // been identified as router nodes. They will | | // been identified as router nodes. They will | |
| // be used in searches, but they will never | | // be used in searches, but they will never | |
| // be added to the routing table. | | // be added to the routing table. | |
| std::set<udp::endpoint> m_router_nodes; | | std::set<udp::endpoint> m_router_nodes; | |
| | | | |
| // these are all the IPs that are in the routing | | // these are all the IPs that are in the routing | |
| // table. It's used to only allow a single entry | | // table. It's used to only allow a single entry | |
| // per IP in the whole table. Currently only for | | // per IP in the whole table. Currently only for | |
| // IPv4 | | // IPv4 | |
|
| std::set<address_v4::bytes_type> m_ips; | | std::multiset<address_v4::bytes_type> m_ips; | |
| }; | | }; | |
| | | | |
| } } // namespace libtorrent::dht | | } } // namespace libtorrent::dht | |
| | | | |
| #endif // ROUTING_TABLE_HPP | | #endif // ROUTING_TABLE_HPP | |
| | | | |
End of changes. 4 change blocks. |
| 3 lines changed or deleted | | 5 lines changed or added | |
|
| storage.hpp | | storage.hpp | |
| | | | |
| skipping to change at line 64 | | skipping to change at line 64 | |
| #include "libtorrent/piece_picker.hpp" | | #include "libtorrent/piece_picker.hpp" | |
| #include "libtorrent/intrusive_ptr_base.hpp" | | #include "libtorrent/intrusive_ptr_base.hpp" | |
| #include "libtorrent/peer_request.hpp" | | #include "libtorrent/peer_request.hpp" | |
| #include "libtorrent/hasher.hpp" | | #include "libtorrent/hasher.hpp" | |
| #include "libtorrent/config.hpp" | | #include "libtorrent/config.hpp" | |
| #include "libtorrent/file.hpp" | | #include "libtorrent/file.hpp" | |
| #include "libtorrent/disk_buffer_holder.hpp" | | #include "libtorrent/disk_buffer_holder.hpp" | |
| #include "libtorrent/thread.hpp" | | #include "libtorrent/thread.hpp" | |
| #include "libtorrent/storage_defs.hpp" | | #include "libtorrent/storage_defs.hpp" | |
| #include "libtorrent/allocator.hpp" | | #include "libtorrent/allocator.hpp" | |
|
| | | #include "libtorrent/bitfield.hpp" | |
| | | | |
| namespace libtorrent | | namespace libtorrent | |
| { | | { | |
| class session; | | class session; | |
| struct file_pool; | | struct file_pool; | |
| struct disk_io_job; | | struct disk_io_job; | |
| struct disk_buffer_pool; | | struct disk_buffer_pool; | |
| struct session_settings; | | struct session_settings; | |
| | | | |
| TORRENT_EXTRA_EXPORT std::vector<std::pair<size_type, std::time_t> >
get_filesizes( | | TORRENT_EXTRA_EXPORT std::vector<std::pair<size_type, std::time_t> >
get_filesizes( | |
| | | | |
| skipping to change at line 252 | | skipping to change at line 253 | |
| boost::intrusive_ptr<file> open_file(file_storage::iterator
fe, int mode | | boost::intrusive_ptr<file> open_file(file_storage::iterator
fe, int mode | |
| , error_code& ec) const; | | , error_code& ec) const; | |
| | | | |
| std::vector<boost::uint8_t> m_file_priority; | | std::vector<boost::uint8_t> m_file_priority; | |
| std::string m_save_path; | | std::string m_save_path; | |
| // the file pool is typically stored in | | // the file pool is typically stored in | |
| // the session, to make all storage | | // the session, to make all storage | |
| // instances use the same pool | | // instances use the same pool | |
| file_pool& m_pool; | | file_pool& m_pool; | |
| | | | |
|
| | | // this is a bitfield with one bit per file. A bit being set | |
| | | means | |
| | | // we've written to that file previously. If we do write to | |
| | | a file | |
| | | // whose bit is 0, we set the file size, to make the file al | |
| | | located | |
| | | // on disk (in full allocation mode) and just sparsely alloc | |
| | | ated in | |
| | | // case of sparse allocation mode | |
| | | bitfield m_file_created; | |
| | | | |
| int m_page_size; | | int m_page_size; | |
| bool m_allocate_files; | | bool m_allocate_files; | |
| }; | | }; | |
| | | | |
| // this storage implementation does not write anything to disk | | // this storage implementation does not write anything to disk | |
| // and it pretends to read, and just leaves garbage in the buffers | | // and it pretends to read, and just leaves garbage in the buffers | |
| // this is useful when simulating many clients on the same machine | | // this is useful when simulating many clients on the same machine | |
| // or when running stress tests and want to take the cost of the | | // or when running stress tests and want to take the cost of the | |
| // disk I/O out of the picture. This cannot be used for any kind | | // disk I/O out of the picture. This cannot be used for any kind | |
| // of normal bittorrent operation, since it will just send garbage | | // of normal bittorrent operation, since it will just send garbage | |
| | | | |
End of changes. 2 change blocks. |
| 0 lines changed or deleted | | 12 lines changed or added | |
|
| torrent.hpp | | torrent.hpp | |
| | | | |
| skipping to change at line 703 | | skipping to change at line 703 | |
| void set_uuid(std::string const& s) { m_uuid = s; } | | void set_uuid(std::string const& s) { m_uuid = s; } | |
| std::string const& url() const { return m_url; } | | std::string const& url() const { return m_url; } | |
| void set_url(std::string const& s) { m_url = s; } | | void set_url(std::string const& s) { m_url = s; } | |
| std::string const& source_feed_url() const { return m_source
_feed_url; } | | std::string const& source_feed_url() const { return m_source
_feed_url; } | |
| void set_source_feed_url(std::string const& s) { m_source_fe
ed_url = s; } | | void set_source_feed_url(std::string const& s) { m_source_fe
ed_url = s; } | |
| | | | |
| std::vector<announce_entry> const& trackers() const | | std::vector<announce_entry> const& trackers() const | |
| { return m_trackers; } | | { return m_trackers; } | |
| | | | |
| void replace_trackers(std::vector<announce_entry> const& url
s); | | void replace_trackers(std::vector<announce_entry> const& url
s); | |
|
| void add_tracker(announce_entry const& url); | | | |
| | | // returns true if the tracker was added, and false if it wa | |
| | | s already | |
| | | // in the tracker list (in which case the source was added t | |
| | | o the | |
| | | // entry in the list) | |
| | | bool add_tracker(announce_entry const& url); | |
| | | | |
| torrent_handle get_handle(); | | torrent_handle get_handle(); | |
| | | | |
| void write_resume_data(entry& rd) const; | | void write_resume_data(entry& rd) const; | |
| void read_resume_data(lazy_entry const& rd); | | void read_resume_data(lazy_entry const& rd); | |
| | | | |
| void seen_complete() { m_last_seen_complete = time(0); } | | void seen_complete() { m_last_seen_complete = time(0); } | |
| int time_since_complete() const { return int(time(0) - m_las
t_seen_complete); } | | int time_since_complete() const { return int(time(0) - m_las
t_seen_complete); } | |
| time_t last_seen_complete() const { return m_last_seen_compl
ete; } | | time_t last_seen_complete() const { return m_last_seen_compl
ete; } | |
| | | | |
| | | | |
End of changes. 1 change blocks. |
| 1 lines changed or deleted | | 7 lines changed or added | |
|
| version.hpp | | version.hpp | |
| | | | |
| skipping to change at line 38 | | skipping to change at line 38 | |
| ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
| POSSIBILITY OF SUCH DAMAGE. | | POSSIBILITY OF SUCH DAMAGE. | |
| | | | |
| */ | | */ | |
| | | | |
| #ifndef TORRENT_VERSION_HPP_INCLUDED | | #ifndef TORRENT_VERSION_HPP_INCLUDED | |
| #define TORRENT_VERSION_HPP_INCLUDED | | #define TORRENT_VERSION_HPP_INCLUDED | |
| | | | |
| #define LIBTORRENT_VERSION_MAJOR 0 | | #define LIBTORRENT_VERSION_MAJOR 0 | |
| #define LIBTORRENT_VERSION_MINOR 16 | | #define LIBTORRENT_VERSION_MINOR 16 | |
|
| #define LIBTORRENT_VERSION_TINY 13 | | #define LIBTORRENT_VERSION_TINY 14 | |
| | | | |
| // the format of this version is: MMmmtt | | // the format of this version is: MMmmtt | |
| // M = Major version, m = minor version, t = tiny version | | // M = Major version, m = minor version, t = tiny version | |
| #define LIBTORRENT_VERSION_NUM ((LIBTORRENT_VERSION_MAJOR * 10000) + (LIBTO
RRENT_VERSION_MINOR * 100) + LIBTORRENT_VERSION_TINY) | | #define LIBTORRENT_VERSION_NUM ((LIBTORRENT_VERSION_MAJOR * 10000) + (LIBTO
RRENT_VERSION_MINOR * 100) + LIBTORRENT_VERSION_TINY) | |
| | | | |
|
| #define LIBTORRENT_VERSION "0.16.13.0" | | #define LIBTORRENT_VERSION "0.16.14.0" | |
| #define LIBTORRENT_REVISION "$Rev: 9412 $" | | #define LIBTORRENT_REVISION "$Rev: 9640 $" | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 2 change blocks. |
| 3 lines changed or deleted | | 3 lines changed or added | |
|