| alert_types.hpp | | alert_types.hpp | |
| | | | |
| skipping to change at line 468 | | skipping to change at line 468 | |
| { TORRENT_ASSERT(!url.empty()); } | | { TORRENT_ASSERT(!url.empty()); } | |
| | | | |
| int event; | | int event; | |
| | | | |
| virtual std::auto_ptr<alert> clone() const | | virtual std::auto_ptr<alert> clone() const | |
| { return std::auto_ptr<alert>(new tracker_announce_alert(*th
is)); } | | { return std::auto_ptr<alert>(new tracker_announce_alert(*th
is)); } | |
| virtual char const* what() const { return "tracker announce
sent"; } | | virtual char const* what() const { return "tracker announce
sent"; } | |
| virtual std::string message() const | | virtual std::string message() const | |
| { | | { | |
| const static char* event_str[] = {"none", "completed
", "started", "stopped", "paused"}; | | const static char* event_str[] = {"none", "completed
", "started", "stopped", "paused"}; | |
|
| TORRENT_ASSERT(event < sizeof(event_str)/sizeof(even
t_str[0])); | | TORRENT_ASSERT(event < int(sizeof(event_str)/sizeof(
event_str[0]))); | |
| return tracker_alert::message() + " sending announce
(" + event_str[event] + ")"; | | return tracker_alert::message() + " sending announce
(" + event_str[event] + ")"; | |
| } | | } | |
| }; | | }; | |
| | | | |
| struct TORRENT_EXPORT hash_failed_alert: torrent_alert | | struct TORRENT_EXPORT hash_failed_alert: torrent_alert | |
| { | | { | |
| hash_failed_alert( | | hash_failed_alert( | |
| torrent_handle const& h | | torrent_handle const& h | |
| , int index) | | , int index) | |
| : torrent_alert(h) | | : torrent_alert(h) | |
| | | | |
End of changes. 1 change blocks. |
| 1 lines changed or deleted | | 1 lines changed or added | |
|
| chained_buffer.hpp | | chained_buffer.hpp | |
| | | | |
| skipping to change at line 44 | | skipping to change at line 44 | |
| #define TORRENT_CHAINED_BUFFER_HPP_INCLUDED | | #define TORRENT_CHAINED_BUFFER_HPP_INCLUDED | |
| | | | |
| #include <boost/function.hpp> | | #include <boost/function.hpp> | |
| #include <boost/version.hpp> | | #include <boost/version.hpp> | |
| #if BOOST_VERSION < 103500 | | #if BOOST_VERSION < 103500 | |
| #include <asio/buffer.hpp> | | #include <asio/buffer.hpp> | |
| #else | | #else | |
| #include <boost/asio/buffer.hpp> | | #include <boost/asio/buffer.hpp> | |
| #endif | | #endif | |
| #include <list> | | #include <list> | |
|
| #include <cstring> | | #include <string.h> // for memcpy | |
| | | | |
| namespace libtorrent | | namespace libtorrent | |
| { | | { | |
| #if BOOST_VERSION >= 103500 | | #if BOOST_VERSION >= 103500 | |
| namespace asio = boost::asio; | | namespace asio = boost::asio; | |
| #endif | | #endif | |
| struct chained_buffer | | struct chained_buffer | |
| { | | { | |
| chained_buffer(): m_bytes(0), m_capacity(0) {} | | chained_buffer(): m_bytes(0), m_capacity(0) {} | |
| | | | |
| | | | |
| skipping to change at line 130 | | skipping to change at line 130 | |
| return b.size - b.used_size - (b.start - b.buf); | | return b.size - b.used_size - (b.start - b.buf); | |
| } | | } | |
| | | | |
| // tries to copy the given buffer to the end of the | | // tries to copy the given buffer to the end of the | |
| // last chained buffer. If there's not enough room | | // last chained buffer. If there's not enough room | |
| // it returns false | | // it returns false | |
| bool append(char const* buf, int s) | | bool append(char const* buf, int s) | |
| { | | { | |
| char* insert = allocate_appendix(s); | | char* insert = allocate_appendix(s); | |
| if (insert == 0) return false; | | if (insert == 0) return false; | |
|
| std::memcpy(insert, buf, s); | | memcpy(insert, buf, s); | |
| return true; | | return true; | |
| } | | } | |
| | | | |
| // tries to allocate memory from the end | | // tries to allocate memory from the end | |
| // of the last buffer. If there isn't | | // of the last buffer. If there isn't | |
| // enough room, returns 0 | | // enough room, returns 0 | |
| char* allocate_appendix(int s) | | char* allocate_appendix(int s) | |
| { | | { | |
| if (m_vec.empty()) return 0; | | if (m_vec.empty()) return 0; | |
| buffer_t& b = m_vec.back(); | | buffer_t& b = m_vec.back(); | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 2 lines changed or added | |
|
| http_connection.hpp | | http_connection.hpp | |
| | | | |
| skipping to change at line 79 | | skipping to change at line 79 | |
| | | | |
| // when bottled, the last two arguments to the handler | | // when bottled, the last two arguments to the handler | |
| // will always be 0 | | // will always be 0 | |
| struct TORRENT_EXPORT http_connection : boost::enable_shared_from_this<http
_connection>, boost::noncopyable | | struct TORRENT_EXPORT http_connection : boost::enable_shared_from_this<http
_connection>, boost::noncopyable | |
| { | | { | |
| http_connection(io_service& ios, connection_queue& cc | | http_connection(io_service& ios, connection_queue& cc | |
| , http_handler const& handler, bool bottled = true | | , http_handler const& handler, bool bottled = true | |
| , http_connect_handler const& ch = http_connect_handler() | | , http_connect_handler const& ch = http_connect_handler() | |
| , http_filter_handler const& fh = http_filter_handler()) | | , http_filter_handler const& fh = http_filter_handler()) | |
| : m_sock(ios) | | : m_sock(ios) | |
|
| | | #if TORRENT_USE_I2P | |
| | | , m_i2p_conn(0) | |
| | | #endif | |
| , m_read_pos(0) | | , m_read_pos(0) | |
| , m_resolver(ios) | | , m_resolver(ios) | |
| , m_handler(handler) | | , m_handler(handler) | |
| , m_connect_handler(ch) | | , m_connect_handler(ch) | |
| , m_filter_handler(fh) | | , m_filter_handler(fh) | |
| , m_timer(ios) | | , m_timer(ios) | |
| , m_last_receive(time_now()) | | , m_last_receive(time_now()) | |
| , m_bottled(bottled) | | , m_bottled(bottled) | |
| , m_called(false) | | , m_called(false) | |
| , m_rate_limit(0) | | , m_rate_limit(0) | |
| | | | |
End of changes. 1 change blocks. |
| 0 lines changed or deleted | | 3 lines changed or added | |
|
| lazy_entry.hpp | | lazy_entry.hpp | |
| | | | |
| skipping to change at line 65 | | skipping to change at line 65 | |
| | | | |
| struct lazy_dict_entry; | | struct lazy_dict_entry; | |
| | | | |
| struct TORRENT_EXPORT lazy_entry | | struct TORRENT_EXPORT lazy_entry | |
| { | | { | |
| enum entry_type_t | | enum entry_type_t | |
| { | | { | |
| none_t, dict_t, list_t, string_t, int_t | | none_t, dict_t, list_t, string_t, int_t | |
| }; | | }; | |
| | | | |
|
| lazy_entry() : m_type(none_t), m_begin(0), m_end(0) | | lazy_entry() : m_type(none_t), m_size(0), m_capacity(0), m_b
egin(0), m_end(0) | |
| { m_data.start = 0; } | | { m_data.start = 0; } | |
| | | | |
| entry_type_t type() const { return m_type; } | | entry_type_t type() const { return m_type; } | |
| | | | |
| // start points to the first decimal digit | | // start points to the first decimal digit | |
| // length is the number of digits | | // length is the number of digits | |
| void construct_int(char const* start, int length) | | void construct_int(char const* start, int length) | |
| { | | { | |
| TORRENT_ASSERT(m_type == none_t); | | TORRENT_ASSERT(m_type == none_t); | |
| m_type = int_t; | | m_type = int_t; | |
| | | | |
End of changes. 1 change blocks. |
| 1 lines changed or deleted | | 1 lines changed or added | |
|
| node.hpp | | node.hpp | |
| | | | |
| skipping to change at line 223 | | skipping to change at line 223 | |
| // return false if the data is not stored on this node. If | | // return false if the data is not stored on this node. If | |
| // the data is stored, it should be serialized into 'data'. | | // the data is stored, it should be serialized into 'data'. | |
| bool on_find(msg const& m, std::vector<tcp::endpoint>& peers) const; | | bool on_find(msg const& m, std::vector<tcp::endpoint>& peers) const; | |
| | | | |
| // this is called when a store request is received. The data | | // this is called when a store request is received. The data | |
| // is store-parameters and the data to be stored. | | // is store-parameters and the data to be stored. | |
| void on_announce(msg const& m, msg& reply); | | void on_announce(msg const& m, msg& reply); | |
| | | | |
| dht_settings const& m_settings; | | dht_settings const& m_settings; | |
| | | | |
|
| // the maximum number of peers to send in a get_peers | | | |
| // reply. Ordinary trackers usually limit this to 50. | | | |
| // 50 => 6 * 50 = 250 bytes + packet overhead | | | |
| int m_max_peers_reply; | | | |
| | | | |
| private: | | private: | |
| typedef boost::mutex mutex_t; | | typedef boost::mutex mutex_t; | |
| mutex_t m_mutex; | | mutex_t m_mutex; | |
| | | | |
| // this list must be destructed after the rpc manager | | // this list must be destructed after the rpc manager | |
| // since it might have references to it | | // since it might have references to it | |
| std::set<traversal_algorithm*> m_running_requests; | | std::set<traversal_algorithm*> m_running_requests; | |
| | | | |
| void incoming_request(msg const& h); | | void incoming_request(msg const& h); | |
| | | | |
| | | | |
End of changes. 1 change blocks. |
| 5 lines changed or deleted | | 0 lines changed or added | |
|
| piece_picker.hpp | | piece_picker.hpp | |
| | | | |
| skipping to change at line 52 | | skipping to change at line 52 | |
| #endif | | #endif | |
| | | | |
| #include <boost/static_assert.hpp> | | #include <boost/static_assert.hpp> | |
| | | | |
| #ifdef _MSC_VER | | #ifdef _MSC_VER | |
| #pragma warning(pop) | | #pragma warning(pop) | |
| #endif | | #endif | |
| | | | |
| #include "libtorrent/peer_id.hpp" | | #include "libtorrent/peer_id.hpp" | |
| #include "libtorrent/socket.hpp" | | #include "libtorrent/socket.hpp" | |
|
| #include "libtorrent/session_settings.hpp" | | | |
| #include "libtorrent/config.hpp" | | #include "libtorrent/config.hpp" | |
| #include "libtorrent/assert.hpp" | | #include "libtorrent/assert.hpp" | |
| #include "libtorrent/time.hpp" | | #include "libtorrent/time.hpp" | |
| | | | |
| namespace libtorrent | | namespace libtorrent | |
| { | | { | |
| | | | |
| class torrent; | | class torrent; | |
| class peer_connection; | | class peer_connection; | |
| struct bitfield; | | struct bitfield; | |
| | | | |
| struct TORRENT_EXPORT piece_block | | struct TORRENT_EXPORT piece_block | |
| { | | { | |
|
| | | const static piece_block invalid; | |
| | | | |
| piece_block() {} | | piece_block() {} | |
| piece_block(int p_index, int b_index) | | piece_block(int p_index, int b_index) | |
| : piece_index(p_index) | | : piece_index(p_index) | |
| , block_index(b_index) | | , block_index(b_index) | |
| {} | | {} | |
| int piece_index; | | int piece_index; | |
| int block_index; | | int block_index; | |
| | | | |
| bool operator<(piece_block const& b) const | | bool operator<(piece_block const& b) const | |
| { | | { | |
| | | | |
| skipping to change at line 143 | | skipping to change at line 144 | |
| // pick pieces in sequential order | | // pick pieces in sequential order | |
| sequential = 16, | | sequential = 16, | |
| // have affinity to pieces with the same speed categ
ory | | // have affinity to pieces with the same speed categ
ory | |
| speed_affinity = 32, | | speed_affinity = 32, | |
| // ignore the prefer_whole_pieces parameter | | // ignore the prefer_whole_pieces parameter | |
| ignore_whole_pieces = 64 | | ignore_whole_pieces = 64 | |
| }; | | }; | |
| | | | |
| struct downloading_piece | | struct downloading_piece | |
| { | | { | |
|
| downloading_piece(): last_request(min_time()), finis | | downloading_piece(): state(none), index(-1), info(0) | |
| hed(0), writing(0), requested(0) {} | | , finished(0), writing(0), requested(0) {} | |
| | | | |
| piece_state_t state; | | piece_state_t state; | |
|
| ptime last_request; | | | |
| | | | |
| // the index of the piece | | // the index of the piece | |
| int index; | | int index; | |
| // info about each block | | // info about each block | |
| // this is a pointer into the m_block_info | | // this is a pointer into the m_block_info | |
| // vector owned by the piece_picker | | // vector owned by the piece_picker | |
| block_info* info; | | block_info* info; | |
| // the number of blocks in the finished state | | // the number of blocks in the finished state | |
| boost::int16_t finished; | | boost::int16_t finished; | |
| // the number of blocks in the writing state | | // the number of blocks in the writing state | |
| | | | |
| skipping to change at line 286 | | skipping to change at line 288 | |
| // marks this piece-block as queued for downloading | | // marks this piece-block as queued for downloading | |
| bool mark_as_downloading(piece_block block, void* peer | | bool mark_as_downloading(piece_block block, void* peer | |
| , piece_state_t s); | | , piece_state_t s); | |
| // returns true if the block was marked as writing, | | // returns true if the block was marked as writing, | |
| // and false if the block is already finished or writing | | // and false if the block is already finished or writing | |
| bool mark_as_writing(piece_block block, void* peer); | | bool mark_as_writing(piece_block block, void* peer); | |
| | | | |
| void mark_as_finished(piece_block block, void* peer); | | void mark_as_finished(piece_block block, void* peer); | |
| void write_failed(piece_block block); | | void write_failed(piece_block block); | |
| int num_peers(piece_block block) const; | | int num_peers(piece_block block) const; | |
|
| ptime last_request(int piece) const; | | | |
| | | | |
| // returns information about the given piece | | // returns information about the given piece | |
| void piece_info(int index, piece_picker::downloading_piece&
st) const; | | void piece_info(int index, piece_picker::downloading_piece&
st) const; | |
| | | | |
| // if a piece had a hash-failure, it must be restored and | | // if a piece had a hash-failure, it must be restored and | |
| // made available for redownloading | | // made available for redownloading | |
| void restore_piece(int index); | | void restore_piece(int index); | |
| | | | |
| // clears the given piece's download flag | | // clears the given piece's download flag | |
| // this means that this piece-block can be picked again | | // this means that this piece-block can be picked again | |
| | | | |
| skipping to change at line 549 | | skipping to change at line 550 | |
| int m_sparse_regions; | | int m_sparse_regions; | |
| | | | |
| // if this is set to true, it means update_pieces() | | // if this is set to true, it means update_pieces() | |
| // has to be called before accessing m_pieces. | | // has to be called before accessing m_pieces. | |
| mutable bool m_dirty; | | mutable bool m_dirty; | |
| public: | | public: | |
| | | | |
| enum { max_pieces = piece_pos::we_have_index - 1 }; | | enum { max_pieces = piece_pos::we_have_index - 1 }; | |
| | | | |
| }; | | }; | |
|
| | | | |
| inline int piece_picker::blocks_in_piece(int index) const | | | |
| { | | | |
| TORRENT_ASSERT(index >= 0); | | | |
| TORRENT_ASSERT(index < (int)m_piece_map.size()); | | | |
| if (index+1 == (int)m_piece_map.size()) | | | |
| return m_blocks_in_last_piece; | | | |
| else | | | |
| return m_blocks_per_piece; | | | |
| } | | | |
| | | | |
| } | | } | |
| | | | |
| #endif // TORRENT_PIECE_PICKER_HPP_INCLUDED | | #endif // TORRENT_PIECE_PICKER_HPP_INCLUDED | |
| | | | |
End of changes. 6 change blocks. |
| 16 lines changed or deleted | | 5 lines changed or added | |
|
| session_impl.hpp | | session_impl.hpp | |
| | | | |
| skipping to change at line 296 | | skipping to change at line 296 | |
| torrent_handle find_torrent_handle(sha1_hash const&
info_hash); | | torrent_handle find_torrent_handle(sha1_hash const&
info_hash); | |
| | | | |
| void announce_lsd(sha1_hash const& ih); | | void announce_lsd(sha1_hash const& ih); | |
| | | | |
| void save_state(entry& e, boost::uint32_t flags, ses
sion_impl::mutex_t::scoped_lock& l) const; | | void save_state(entry& e, boost::uint32_t flags, ses
sion_impl::mutex_t::scoped_lock& l) const; | |
| void load_state(lazy_entry const& e); | | void load_state(lazy_entry const& e); | |
| | | | |
| void set_proxy(proxy_settings const& s); | | void set_proxy(proxy_settings const& s); | |
| proxy_settings const& proxy() const { return m_peer_
proxy; } | | proxy_settings const& proxy() const { return m_peer_
proxy; } | |
| | | | |
|
| #ifndef TORRENT_NO_DEPRECATE | | | |
| void set_peer_proxy(proxy_settings const& s) | | void set_peer_proxy(proxy_settings const& s) | |
| { | | { | |
| m_peer_proxy = s; | | m_peer_proxy = s; | |
| // in case we just set a socks proxy, we mig
ht have to | | // in case we just set a socks proxy, we mig
ht have to | |
| // open the socks incoming connection | | // open the socks incoming connection | |
| if (!m_socks_listen_socket) open_new_incomin
g_socks_connection(); | | if (!m_socks_listen_socket) open_new_incomin
g_socks_connection(); | |
| } | | } | |
| void set_web_seed_proxy(proxy_settings const& s) | | void set_web_seed_proxy(proxy_settings const& s) | |
| { m_web_seed_proxy = s; } | | { m_web_seed_proxy = s; } | |
| void set_tracker_proxy(proxy_settings const& s) | | void set_tracker_proxy(proxy_settings const& s) | |
| | | | |
| skipping to change at line 325 | | skipping to change at line 323 | |
| | | | |
| #ifndef TORRENT_DISABLE_DHT | | #ifndef TORRENT_DISABLE_DHT | |
| void set_dht_proxy(proxy_settings const& s) | | void set_dht_proxy(proxy_settings const& s) | |
| { | | { | |
| m_dht_proxy = s; | | m_dht_proxy = s; | |
| m_dht_socket.set_proxy_settings(s); | | m_dht_socket.set_proxy_settings(s); | |
| } | | } | |
| proxy_settings const& dht_proxy() const | | proxy_settings const& dht_proxy() const | |
| { return m_dht_proxy; } | | { return m_dht_proxy; } | |
| #endif | | #endif | |
|
| #endif // TORRENT_NO_DEPRECATE | | | |
| | | | |
| #ifndef TORRENT_DISABLE_GEO_IP | | #ifndef TORRENT_DISABLE_GEO_IP | |
| std::string as_name_for_ip(address const& a); | | std::string as_name_for_ip(address const& a); | |
| int as_for_ip(address const& a); | | int as_for_ip(address const& a); | |
| std::pair<const int, int>* lookup_as(int as); | | std::pair<const int, int>* lookup_as(int as); | |
| bool load_asnum_db(char const* file); | | bool load_asnum_db(char const* file); | |
| bool has_asnum_db() const { return m_asnum_db; } | | bool has_asnum_db() const { return m_asnum_db; } | |
| | | | |
| bool load_country_db(char const* file); | | bool load_country_db(char const* file); | |
| bool has_country_db() const { return m_country_db; } | | bool has_country_db() const { return m_country_db; } | |
| | | | |
End of changes. 2 change blocks. |
| 2 lines changed or deleted | | 0 lines changed or added | |
|
| storage.hpp | | storage.hpp | |
| | | | |
| skipping to change at line 76 | | skipping to change at line 76 | |
| { | | { | |
| struct piece_checker_data; | | struct piece_checker_data; | |
| } | | } | |
| | | | |
| namespace fs = boost::filesystem; | | namespace fs = boost::filesystem; | |
| | | | |
| 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; | |
| | | | |
| enum storage_mode_t | | enum storage_mode_t | |
| { | | { | |
| storage_mode_allocate = 0, | | storage_mode_allocate = 0, | |
| storage_mode_sparse, | | storage_mode_sparse, | |
| storage_mode_compact | | storage_mode_compact | |
| }; | | }; | |
| | | | |
| TORRENT_EXPORT std::vector<std::pair<size_type, std::time_t> > get_f
ilesizes( | | TORRENT_EXPORT std::vector<std::pair<size_type, std::time_t> > get_f
ilesizes( | |
| file_storage const& t | | file_storage const& t | |
| | | | |
| skipping to change at line 300 | | skipping to change at line 301 | |
| { return m_storage->verify_resume_data(rd, e); } | | { return m_storage->verify_resume_data(rd, e); } | |
| | | | |
| bool is_allocating() const | | bool is_allocating() const | |
| { return m_state == state_expand_pieces; } | | { return m_state == state_expand_pieces; } | |
| | | | |
| void mark_failed(int index); | | void mark_failed(int index); | |
| | | | |
| error_code const& error() const { return m_storage->error();
} | | error_code const& error() const { return m_storage->error();
} | |
| std::string const& error_file() const { return m_storage->er
ror_file(); } | | std::string const& error_file() const { return m_storage->er
ror_file(); } | |
| int last_piece() const { return m_last_piece; } | | int last_piece() const { return m_last_piece; } | |
|
| int last_operation() const { return m_last_op; } | | | |
| void clear_error() { m_storage->clear_error(); } | | void clear_error() { m_storage->clear_error(); } | |
| | | | |
| int slot_for(int piece) const; | | int slot_for(int piece) const; | |
| int piece_for(int slot) const; | | int piece_for(int slot) const; | |
| | | | |
| // helper functions for check_dastresume | | // helper functions for check_dastresume | |
| int check_no_fastresume(error_code& error); | | int check_no_fastresume(error_code& error); | |
| int check_init_storage(error_code& error); | | int check_init_storage(error_code& error); | |
| | | | |
| // if error is set and return value is 'no_error' or 'need_f
ull_check' | | // if error is set and return value is 'no_error' or 'need_f
ull_check' | |
| | | | |
| skipping to change at line 436 | | skipping to change at line 436 | |
| // the storage from compact allocation | | // the storage from compact allocation | |
| // to full allocation | | // to full allocation | |
| disk_buffer_holder m_scratch_buffer; | | disk_buffer_holder m_scratch_buffer; | |
| disk_buffer_holder m_scratch_buffer2; | | disk_buffer_holder m_scratch_buffer2; | |
| // the piece that is in the scratch buffer | | // the piece that is in the scratch buffer | |
| int m_scratch_piece; | | int m_scratch_piece; | |
| | | | |
| // the last piece we wrote to or read from | | // the last piece we wrote to or read from | |
| int m_last_piece; | | int m_last_piece; | |
| | | | |
|
| // the last operation we did (read or write) | | | |
| int m_last_op; | | | |
| | | | |
| // this is saved in case we need to instantiate a new | | // this is saved in case we need to instantiate a new | |
| // storage (osed when remapping files) | | // storage (osed when remapping files) | |
| storage_constructor_type m_storage_constructor; | | storage_constructor_type m_storage_constructor; | |
| | | | |
| // this maps a piece hash to piece index. It will be | | // this maps a piece hash to piece index. It will be | |
| // build the first time it is used (to save time if it | | // build the first time it is used (to save time if it | |
| // isn't needed) | | // isn't needed) | |
| std::multimap<sha1_hash, int> m_hash_to_piece; | | std::multimap<sha1_hash, int> m_hash_to_piece; | |
| | | | |
| // this map contains partial hashes for downloading | | // this map contains partial hashes for downloading | |
| | | | |
End of changes. 3 change blocks. |
| 4 lines changed or deleted | | 1 lines changed or added | |
|
| time.hpp | | time.hpp | |
| | | | |
| skipping to change at line 226 | | skipping to change at line 226 | |
| return td.diff; | | return td.diff; | |
| } | | } | |
| | | | |
| inline ptime time_now_hires() | | inline ptime time_now_hires() | |
| { | | { | |
| static mach_timebase_info_data_t timebase_info = {0,0}; | | static mach_timebase_info_data_t timebase_info = {0,0}; | |
| if (timebase_info.denom == 0) | | if (timebase_info.denom == 0) | |
| mach_timebase_info(&timebase_info); | | mach_timebase_info(&timebase_info); | |
| boost::uint64_t at = mach_absolute_time(); | | boost::uint64_t at = mach_absolute_time(); | |
| // make sure we don't overflow | | // make sure we don't overflow | |
|
| TORRENT_ASSERT((at >= 0 && at >= at / 1000 * timebase_info.n
umer / timebase_info.denom) | | TORRENT_ASSERT((at >= at / 1000 * timebase_info.numer / time
base_info.denom) | |
| || (at < 0 && at < at / 1000 * timebase_info.numer /
timebase_info.denom)); | | || (at < 0 && at < at / 1000 * timebase_info.numer /
timebase_info.denom)); | |
| return ptime(at / 1000 * timebase_info.numer / timebase_info
.denom); | | return ptime(at / 1000 * timebase_info.numer / timebase_info
.denom); | |
| } | | } | |
| | | | |
| inline time_duration microsec(boost::int64_t s) | | inline time_duration microsec(boost::int64_t s) | |
| { | | { | |
| return time_duration(s); | | return time_duration(s); | |
| } | | } | |
| inline time_duration milliseconds(boost::int64_t s) | | inline time_duration milliseconds(boost::int64_t s) | |
| { | | { | |
| | | | |
End of changes. 1 change blocks. |
| 1 lines changed or deleted | | 1 lines changed or added | |
|
| torrent_info.hpp | | torrent_info.hpp | |
| | | | |
| skipping to change at line 184 | | skipping to change at line 184 | |
| while (!url.empty() && is_space(url[0])) | | while (!url.empty() && is_space(url[0])) | |
| url.erase(url.begin()); | | url.erase(url.begin()); | |
| } | | } | |
| }; | | }; | |
| | | | |
| #ifndef BOOST_NO_EXCEPTIONS | | #ifndef BOOST_NO_EXCEPTIONS | |
| // for backwards compatibility with 0.14 | | // for backwards compatibility with 0.14 | |
| typedef libtorrent_exception invalid_torrent_file; | | typedef libtorrent_exception invalid_torrent_file; | |
| #endif | | #endif | |
| | | | |
|
| int TORRENT_EXPORT load_file(fs::path const& filename, std::vector<c
har>& v); | | int TORRENT_EXPORT load_file(fs::path const& filename, std::vector<c
har>& v, error_code& ec); | |
| | | | |
| class TORRENT_EXPORT torrent_info : public intrusive_ptr_base<torren
t_info> | | class TORRENT_EXPORT torrent_info : public intrusive_ptr_base<torren
t_info> | |
| { | | { | |
| public: | | public: | |
| torrent_info(torrent_info const& t); | | torrent_info(torrent_info const& t); | |
| #ifndef BOOST_NO_EXCEPTIONS | | #ifndef BOOST_NO_EXCEPTIONS | |
| torrent_info(lazy_entry const& torrent_file); | | torrent_info(lazy_entry const& torrent_file); | |
| torrent_info(char const* buffer, int size); | | torrent_info(char const* buffer, int size); | |
| torrent_info(fs::path const& filename); | | torrent_info(fs::path const& filename); | |
| #ifndef BOOST_FILESYSTEM_NARROW_ONLY | | #ifndef BOOST_FILESYSTEM_NARROW_ONLY | |
| | | | |
End of changes. 1 change blocks. |
| 1 lines changed or deleted | | 1 lines changed or added | |
|
| udp_socket.hpp | | udp_socket.hpp | |
| | | | |
| skipping to change at line 40 | | skipping to change at line 40 | |
| | | | |
| */ | | */ | |
| | | | |
| #ifndef TORRENT_UDP_SOCKET_HPP_INCLUDED | | #ifndef TORRENT_UDP_SOCKET_HPP_INCLUDED | |
| #define TORRENT_UDP_SOCKET_HPP_INCLUDED | | #define TORRENT_UDP_SOCKET_HPP_INCLUDED | |
| | | | |
| #include "libtorrent/socket.hpp" | | #include "libtorrent/socket.hpp" | |
| #include "libtorrent/session_settings.hpp" | | #include "libtorrent/session_settings.hpp" | |
| #include "libtorrent/buffer.hpp" | | #include "libtorrent/buffer.hpp" | |
| | | | |
|
| #include <list> | | #include <deque> | |
| #include <boost/function.hpp> | | #include <boost/function.hpp> | |
| #include <boost/thread/mutex.hpp> | | #include <boost/thread/mutex.hpp> | |
| | | | |
| namespace libtorrent | | namespace libtorrent | |
| { | | { | |
| class connection_queue; | | class connection_queue; | |
| | | | |
| class udp_socket | | class udp_socket | |
| { | | { | |
| public: | | public: | |
| | | | |
| skipping to change at line 113 | | skipping to change at line 113 | |
| void handshake3(error_code const& e); | | void handshake3(error_code const& e); | |
| void handshake4(error_code const& e); | | void handshake4(error_code const& e); | |
| void socks_forward_udp(mutex_t::scoped_lock& l); | | void socks_forward_udp(mutex_t::scoped_lock& l); | |
| void connect1(error_code const& e); | | void connect1(error_code const& e); | |
| void connect2(error_code const& e); | | void connect2(error_code const& e); | |
| void hung_up(error_code const& e); | | void hung_up(error_code const& e); | |
| | | | |
| void wrap(udp::endpoint const& ep, char const* p, int len, e
rror_code& ec); | | void wrap(udp::endpoint const& ep, char const* p, int len, e
rror_code& ec); | |
| void unwrap(error_code const& e, char const* buf, int size); | | void unwrap(error_code const& e, char const* buf, int size); | |
| | | | |
|
| | | bool maybe_clear_callback(mutex_t::scoped_lock& l); | |
| | | | |
| mutable mutex_t m_mutex; | | mutable mutex_t m_mutex; | |
| | | | |
| udp::socket m_ipv4_sock; | | udp::socket m_ipv4_sock; | |
| udp::endpoint m_v4_ep; | | udp::endpoint m_v4_ep; | |
| char m_v4_buf[1600]; | | char m_v4_buf[1600]; | |
| | | | |
| #if TORRENT_USE_IPV6 | | #if TORRENT_USE_IPV6 | |
| udp::socket m_ipv6_sock; | | udp::socket m_ipv6_sock; | |
| udp::endpoint m_v6_ep; | | udp::endpoint m_v6_ep; | |
| char m_v6_buf[1600]; | | char m_v6_buf[1600]; | |
| #endif | | #endif | |
| | | | |
|
| int m_bind_port; | | boost::uint16_t m_bind_port; | |
| char m_outstanding; | | boost::uint8_t m_v4_outstanding; | |
| | | #if TORRENT_USE_IPV6 | |
| | | boost::uint8_t m_v6_outstanding; | |
| | | #endif | |
| | | | |
| tcp::socket m_socks5_sock; | | tcp::socket m_socks5_sock; | |
| int m_connection_ticket; | | int m_connection_ticket; | |
| proxy_settings m_proxy_settings; | | proxy_settings m_proxy_settings; | |
| connection_queue& m_cc; | | connection_queue& m_cc; | |
| tcp::resolver m_resolver; | | tcp::resolver m_resolver; | |
| char m_tmp_buf[100]; | | char m_tmp_buf[100]; | |
| bool m_queue_packets; | | bool m_queue_packets; | |
| bool m_tunnel_packets; | | bool m_tunnel_packets; | |
| bool m_abort; | | bool m_abort; | |
| udp::endpoint m_proxy_addr; | | udp::endpoint m_proxy_addr; | |
| // while we're connecting to the proxy | | // while we're connecting to the proxy | |
| // we have to queue the packets, we'll flush | | // we have to queue the packets, we'll flush | |
| // them once we're connected | | // them once we're connected | |
|
| std::list<queued_packet> m_queue; | | std::deque<queued_packet> m_queue; | |
| | | | |
| | | // counts the number of outstanding async | |
| | | // operations hanging on this socket | |
| | | int m_outstanding_ops; | |
| | | | |
| #ifdef TORRENT_DEBUG | | #ifdef TORRENT_DEBUG | |
| bool m_started; | | bool m_started; | |
| int m_magic; | | int m_magic; | |
| int m_outstanding_when_aborted; | | int m_outstanding_when_aborted; | |
| #endif | | #endif | |
| }; | | }; | |
| | | | |
| struct rate_limited_udp_socket : public udp_socket | | struct rate_limited_udp_socket : public udp_socket | |
| { | | { | |
| rate_limited_udp_socket(io_service& ios, callback_t const& c
, connection_queue& cc); | | rate_limited_udp_socket(io_service& ios, callback_t const& c
, connection_queue& cc); | |
| | | | |
| skipping to change at line 165 | | skipping to change at line 175 | |
| void close(); | | void close(); | |
| | | | |
| private: | | private: | |
| void on_tick(error_code const& e); | | void on_tick(error_code const& e); | |
| | | | |
| deadline_timer m_timer; | | deadline_timer m_timer; | |
| int m_queue_size_limit; | | int m_queue_size_limit; | |
| int m_rate_limit; | | int m_rate_limit; | |
| int m_quota; | | int m_quota; | |
| ptime m_last_tick; | | ptime m_last_tick; | |
|
| std::list<queued_packet> m_queue; | | std::deque<queued_packet> m_queue; | |
| }; | | }; | |
| } | | } | |
| | | | |
| #endif | | #endif | |
| | | | |
End of changes. 5 change blocks. |
| 5 lines changed or deleted | | 15 lines changed or added | |
|