arvidn
061732ddec
bump version
2017-09-04 15:35:45 +02:00
arvidn
53ff169db1
use string_view in find_metric_idx
2017-09-04 07:50:13 +02:00
arvidn
fe1c395579
merged RC_1_1 into master
2017-09-03 13:57:19 +02:00
Steven Siloti
5361ffc1c2
add_file_borrow: use string_view instead of pointer, size parameters ( #2302 )
2017-09-02 23:58:36 +02:00
arvidn
7087a16b36
move some initialization of torrent from start() into the constructor
2017-09-02 21:24:00 +02:00
arvidn
24d08cdf82
fix protocol_str in portmap_alert
2017-09-02 10:39:55 +02:00
arvidn
2025c15ec1
cleanup tokenize_string -> split_string
2017-09-02 07:46:16 +02:00
arvidn
f8ba4f480f
use span in parse_utf8_codepoint
2017-09-02 07:03:46 +02:00
arvidn
11f008e90e
use a strong typedef for port mapping id
2017-09-02 07:02:07 +02:00
Alden Torres
ac914d4415
avoid port mapping of local addresses ( #2296 )
2017-09-01 19:28:27 +02:00
Steven Siloti
f022285b13
include endpoint in tracker alerts
2017-09-01 13:38:36 +02:00
Arvid Norberg
f734ad067b
straighten out some type-safety in port mapping enums ( #2285 )
2017-08-30 20:47:49 +02:00
Alden Torres
fe09ca9b97
more use of auto, const and minor cleanup in session_impl.cpp
2017-08-30 20:30:06 +02:00
Steven Siloti
621da10e60
hold an owning reference to storage objects in try_flush_write_blocks
...
It is possible for all other references to a storage object to be
destroyed while try_flush_write_blocks is running. If the storage is
destroyed then find_piece will crash when trying to re-aquire the
shared_ptr. To prevent this, keep the storage alive by holding a
shared_ptr to it in try_flush_write_blocks.
Normally the fence job when stopping a torrent would prevent the storage
object from being destroyed until all flush jobs are complete.
try_flush_write_blocks can be run after every disk job though so it has
the potential to "stradle the fence".
If the associated torrent does get unloaded then it is expected that
find_piece will return NULL thus causing the entry to be ignored.
2017-08-30 12:45:06 +02:00
Alden Torres
d0ea585859
minor code optimization in broadcast_socket.cpp
2017-08-29 22:29:11 +02:00
Steven Siloti
52ccad23b9
read_piece: handle failure to allocate piece buffer
2017-08-29 12:24:17 +02:00
Alden Torres
5db597c8b3
more use of std::tuple_size<> and empty()
2017-08-28 22:47:34 +02:00
Arvid Norberg
1075ae3b8d
remove session pool allocator and use the buffer class instead ( #2274 )
...
simplify append_buffer by using size() to determine size of the buffer. make the move explicit in chained_buffer::init_buffer_entry
2017-08-28 11:37:53 +02:00
Steven Siloti
d4986f878f
treat unique local addresses as local
...
These addresses are not globally routable so they should be considered local.
2017-08-28 11:34:47 +02:00
Arvid Norberg
d250ba5a17
wrap destination string in i2p_peer in string_ptr handler ( #2268 )
2017-08-25 09:42:46 +02:00
arvidn
1ce4089229
log failures to parse interface and node lists from settings
2017-08-24 07:59:22 +02:00
arvidn
e92cbf502c
remove the last use of session_impl get_ipv6_interface and get_ipv4_interface
2017-08-23 21:01:15 +02:00
arvidn
1290e6f5af
simplify buffer handling in rc4_decrypt calls
2017-08-23 07:01:12 +02:00
arvidn
22c047f8a0
factor out and simplify get_syncoffset
2017-08-23 06:59:44 +02:00
arvidn
f311bf354e
remove left-overs from disk buffer pool allocator
2017-08-21 16:36:00 +02:00
Alden Torres
5130827fc7
minor code refactor and cleanup in bt_peer_connection ( #2261 )
2017-08-21 11:00:00 +02:00
arvidn
d59d394d5b
remove residual mentions of mtu for interfaces
2017-08-20 22:34:20 +02:00
Alden Torres
66734e2e5b
using if_indextoname instead of RTM_GETLINK to fill the interface name in enum_net_interfaces ( #2253 )
...
using if_indextoname instead of RTM_GETLINK to fill the interface name in enum_net_interfaces. removed IFA_LABEL switch case, removed ip_interface::mtu, master rebase
2017-08-20 10:55:59 +02:00
arvidn
fe37884bc6
fix IPv6 tracker support by performing the second announce in more cases
2017-08-19 18:56:51 +02:00
Steven Siloti
2365611507
remove support for using a pool allocator for disk buffers ( #2257 )
2017-08-19 11:04:39 +02:00
Steven Siloti
73e898e38e
disable disk cache pool allocator by default
...
The pool allocator has known issues with not releasing memory when it should
and is of dubious benefit.
See #2251
2017-08-18 09:39:24 +02:00
Alden Torres
070066e892
more use of emplace_back and minor code simplification
2017-08-17 08:08:51 +02:00
arvidn
05b5b4ef4d
merged RC_1_1 into master
2017-08-16 22:46:47 +02:00
arvidn
b5fe0f95a2
fix issue in UTF-8 encoding validation
2017-08-16 13:15:19 +02:00
arvidn
b70d3efba9
fix infinite loop when parsing torrents whose filenames have zeroes. #2247
2017-08-16 07:21:34 +02:00
Alden Torres
bde4718e3f
typos, auto loop refactor and more std::
2017-08-16 07:01:50 +02:00
Alden Torres
6a3be6cfd3
minor trivial code optimization
2017-08-15 23:30:28 +02:00
arvidn
fcb9c7b6f3
fix invalid read in parse_int() in bdecode_node() and lazy_bdecode()
2017-08-15 00:01:37 +02:00
Alden Torres
48de05ba82
lint-based code review in utp related code
2017-08-13 07:49:43 +02:00
Steven Siloti
50c2aee8ec
don't create web seed connections if the torrent is upload only
...
The fix in 9a63d4696e
was imcomplete.
It turns out disconnect_if_redundant decrements the connection count
which unballances the count if we do end up disconnecting the peer.
This change avoids the problem by checking if the torrent is
upload only much sooner, before the connection object is even created.
We still do a redundancy check just-in-case, but it is not expected to
trigger.
2017-08-11 08:16:00 +02:00
Alden Torres
0ac01a8532
header fix for use of stringstream
2017-08-10 22:02:10 +02:00
arvidn
5f4816f1d8
fix include in http_connection.cpp
2017-08-10 19:47:42 +02:00
arvidn
865ff09a84
merge RC_1_1 into master
2017-08-10 16:44:57 +02:00
arvidn
560ef29276
fix issue with very long tracker- and web seed URLs. Instead of using a fixed length stack allocated request buffer, use a dynamically growing stringstream
2017-08-10 14:01:11 +02:00
arvidn
4e497e1383
fix issue where paths were not correctly coalesced when adding files to file_storage (used more memory than necessary)
2017-08-10 12:10:46 +02:00
arvidn
bb6f2b9837
extend file_storage tests. Make pad files separate paths and file names properly
2017-08-10 01:33:35 +02:00
arvidn
378a0e974b
fix issue of force-recheck or seeding from read-only media, torrents with empty files in them. Previously libtorrent would create empty files up-front unconditionally, now they won't be created if they already exist
2017-08-09 18:48:49 +02:00
Alden Torres
721c4d016a
more use of emplace_back in write_resume_data ( #2221 )
2017-08-09 00:19:11 +02:00
Alden Torres
8ed17ab311
minor code refactor, more use of nullptr, typos
2017-08-07 21:15:14 +02:00
arvidn
2b98951ace
assert that trackers are not announced to while checking files
2017-08-06 20:21:03 +02:00
arvidn
1f3730fa5a
fix force-recheck issue (new files would not be picked up)
2017-08-06 09:49:51 +02:00
Alden Torres
0b83b6b6df
fix typo and extra ::alert
2017-08-06 04:28:36 +02:00
arvidn
7b98af8145
improve type-safety of observer_flags and traversal_flags
2017-08-05 20:20:13 +02:00
Steven Siloti
f2d1a283bc
Call DebugBreak on assertion failure
2017-08-05 03:01:59 +02:00
Alden Torres
1e05a91f99
added some std:: in public api
2017-08-05 02:44:25 +02:00
arvidn
5bf28e37b8
make create_torrent flags type-safe
2017-08-04 21:23:42 +02:00
Alden Torres
cb114a80e1
reverted ino_t cast and added fix only for android
2017-08-04 21:22:20 +02:00
arvidn
6b1037eff5
convert enum values that are just used as constants, to actual constants with the correct type
2017-08-04 15:23:20 +02:00
arvidn
a8a5986046
make file attributes (in file_storage) type safe
2017-08-04 07:38:57 +02:00
Alden Torres
35232a5a5f
fixed -Wshorten-64-to-32 in 32 bits and explicit nullptr check
2017-08-04 06:07:18 +02:00
arvidn
6fa181ece8
some cleanup of type-safe flags
2017-07-30 18:20:15 -07:00
arvidn
322007bb6a
make save_state_flags a strong type
2017-07-30 09:06:41 -07:00
arvidn
69bd2986de
convert a few more torrent_handle flags to type safe types
2017-07-27 13:16:23 -07:00
arvidn
204a029b5f
merged RC_1_1 into master
2017-07-27 11:37:02 -07:00
arvidn
24e4263bae
make torrent status flags be type safe
2017-07-27 09:33:35 -07:00
arvidn
5222d92e9f
make resume_data_flags type safe
2017-07-27 00:07:15 -07:00
arvidn
8d0f38930e
make udp send flags type safe
2017-07-26 18:09:17 -07:00
arvidn
83ca755d1b
simplify setup_listener
2017-07-26 12:02:58 -07:00
arvidn
cd343c91bc
make base32encode flags type safe
2017-07-26 10:38:14 -07:00
arvidn
b38efb6c65
make alert category flags be a strong type
2017-07-26 07:20:47 -07:00
arvidn
c167e28788
move stack allocator implementation into its own cpp file
2017-07-23 16:49:24 -07:00
arvidn
330904f460
convert picker_flags_t to type safe flags
2017-07-23 09:29:25 -07:00
arvidn
78bbd298a5
convert file_open_mode to type safe flags
2017-07-22 23:58:24 -07:00
Steven Siloti
140b8ace8d
remove use of deprecated function readdir_r
2017-07-22 22:40:17 -07:00
arvidn
c4eb4c8b5f
use span in torrent_info constructors and deprecate the redundant flags argument
2017-07-22 00:00:44 -07:00
arvidn
cedd468300
backport fix to clearing of piece picker in suggest_read_cache mode
2017-07-22 00:00:14 -07:00
Steven Siloti
5eba09fce7
changes based on review feedback
2017-07-21 19:18:44 -07:00
Steven Siloti
1a64490ef0
fix
2017-07-21 19:18:44 -07:00
Steven Siloti
f0ae2145ea
use a handle class for listen sockets instead of raw pointers
...
Listen socket handles need to be week_ptr so that they can detect when a listen
socket is removed in the middle of a tracker announce on it. Use a wrapper class
to enforce that no one outside of session_impl can hold ownership of the socket
across event boundaries.
To support unit tests, listen_socket_t is also split into a base class which
holds the members needed to support the public listen socket API.
2017-07-21 19:18:44 -07:00
Steven Siloti
e0dcd34352
convert m_listen_sockets to a vector of shared_ptr
2017-07-21 19:18:43 -07:00
Steven Siloti
0f30815d8f
Revert "don't move listen_socket_t when deleting sockets"
...
This reverts commit 718c5f0dcb
.
2017-07-21 19:18:43 -07:00
arvidn
87ca4bb26f
Fix bug where the resume data would fail to load the piece bitmask for seeds when suggest_cache was enabled
2017-07-21 19:06:02 -07:00
arvidn
33a2abebfe
submit disk jobs in read_piece()
2017-07-18 07:21:07 -07:00
arvidn
f9c45db942
make bandwidth state flags use type-safe flags
2017-07-17 19:03:42 -07:00
arvidn
06070ea499
convert block request flags to type-safe flags
2017-07-17 17:56:07 -07:00
Pavel Pimenov
ea8c5b32da
add reserve entry::to_string() ( #2148 )
2017-07-17 15:05:58 -07:00
arvidn
c4659bc345
convert peer_flags and peer_source_flags to type-safe flags
2017-07-17 10:22:32 -07:00
arvidn
4947602a2f
make add_torrent_params::flags_t an enum class and move it out into its own header
2017-07-17 01:05:31 -07:00
AllSeeingEyeTolledEweSew
00655d562b
Refactor several flags to torrent_handle::get_flags/set_flags.
2017-07-17 01:05:31 -07:00
arvidn
73942de97a
carve out peer_list_entry into also being deprecated (it was only used by deprecated functions and some tests)
2017-07-16 19:20:29 -07:00
toinetoine
b1c3e12cd0
added block_uploaded_alert to allow client to track upload activity
2017-07-16 11:04:03 -07:00
arvidn
c4afb5e949
use a dedicated class template for flags types instead of enum class. It's more backwards compatible and improves ergonomics
2017-07-15 01:15:57 -07:00
arvidn
c692147c94
merged RC_1_1 into master
2017-07-13 19:55:29 -07:00
arvidn
cc30434c52
fix inconsistency in file_priorities and override_resume_data behavior. file_priorities are not subject to the override_resume_data flag
2017-07-12 15:36:55 -07:00
pavel.pimenov
a422af1a7b
remove call _strchr
...
_TEXT SEGMENT
_c$ = 8 ; size = 1
?is_space@@YA_ND@Z PROC ; is_space, COMDAT
; 8 : static const char* ws = " \t\n\r\f\v";
; 9 : return strchr(ws, c) != nullptr;
movsx eax, BYTE PTR _c$[esp-4]
push eax
push DWORD PTR ?ws@?1??is_space@@YA_ND@Z@4PBDB
call _strchr
add esp, 8
neg eax
sbb eax, eax
neg eax
; 10 : }
2017-07-12 15:34:45 -07:00
d-komarov
85cf521145
fix bandwith rate limit calculation ( #2134 )
...
back-port of fc0cbfb789
2017-07-11 21:35:12 -07:00
Steven Siloti
2e79c5e648
fix handling of SSL listen sockets
2017-07-10 21:41:39 -07:00
d-komarov
11d6a00bec
fix storage destruction order issue ( #2138 )
...
back-ported from b553cb32f7
2017-07-10 21:35:34 -07:00
Steven Siloti
389b4eb3f2
make listen_socket_t non-copyable and non-movable ( #2137 )
...
The DHT stores a pointer to this struct so it must not be copied or moved once
it is stored in m_listen_sockets.
2017-07-10 10:14:36 -07:00
Steven Siloti
718c5f0dcb
don't move listen_socket_t when deleting sockets
...
Pointers to listen_socket_t are stored in dht_tracker, so they
cannot be copied or moved once they are added to m_listen_sockets.
listen_socket_t should really be made non-copyable and non-moveable, but the
socket creation path needs to be refactored before that can be done.
2017-07-08 08:42:04 -07:00
Alden Torres
80036f0377
avoid executing timed async task if the dht node is already removed ( #2133 )
2017-07-08 08:32:24 -07:00
Alden Torres
10bfe18ebe
added consts and minor code formatting
2017-07-03 16:58:49 -04:00
Alden Torres
285daa21a5
fixed another shorten-64-to-32 warning in netlink code
2017-07-03 13:53:15 -04:00
Steven Siloti
ec2fb91aa5
reject put messages with incorrect bencoding ( #2118 )
...
add function to check for soft bdecode errors. reject put messages with incorrect bencoding
2017-07-02 18:30:32 -04:00
arvidn
5188c190db
bump version number
2017-07-02 15:03:46 -04:00
arvidn
5c37eb174f
drop support for windows compilers without std::string and wchar_t (believed to be old cygwin)
2017-07-02 08:24:55 -04:00
pavel.pimenov
7af38ba05a
add const and static
2017-06-30 16:07:23 -04:00
pavel.pimenov
92a923134c
fix generate_token
2017-06-30 13:22:30 -04:00
arvidn
db09332a02
merged RC_1_1 into master
2017-06-30 08:58:21 -04:00
arvidn
20c1407612
corrected missing const qualifiers on bdecode_node
2017-06-30 08:19:10 -04:00
Alden Torres
a78ec94184
fixed compilation warnings in enum_net netlink code
2017-06-29 15:48:28 -04:00
arvidn
3c8450d47c
fix backwards compatibility issue when loading the torrent info dict from resume data
2017-06-29 15:03:49 -04:00
arvidn
506950001d
fix regression where paused torrents could not have their queue position changed
2017-06-27 12:37:08 -04:00
Steven Siloti
20e05a12ac
broadcast_socket: remove obsolete special case
...
enum_net_interfaces now fills in the scope_id correctly so there's no need for
a special case to set it here.
2017-06-27 08:09:20 -04:00
Steven Siloti
bbf361336b
Use netlink to enumerate network interfaces on linux ( #2105 )
...
* move getting a table dump over netlink to a separate function
* use netlink to enumerate network interfaces on linux
2017-06-27 00:34:24 -04:00
Steven Siloti
0a9e2c965d
invert logic in read_nl_sock for better clarity and reliability ( #2101 )
...
The seq and pid parameter are apparently used as a safety check in case
a stream of netlink messages is not properly terminated. I initially thought
that they represented the expected values of the incoming messages.
Instead seq is set to one-past the expected value and the loop aborts when
seq and pid match the message.
Inverting the logic so that reading continues as long as the seq and pid match
the incoming messages is, to me at least, more intuitive. It is also more
reliable since it does not rely on the next seq being strictly sequential. It
also catches unexpected messages preceding or interleaved with the expected
messages.
There seems to be a lot of confusion all across the internet over the
nlmsg_pid field. The changes here were made based on examination of the
kernel source and iproute2 (a common user of netlink).
The kernel does not read nlmsg_pid at all for routing messages.
Iproute2 sets it to zero unconditionally so I changed this code to do the same.
2017-06-25 10:29:32 -04:00
arvidn
2b91b1070d
merged RC_1_1 into master
2017-06-24 12:37:13 -04:00
Steven Siloti
ec30a5e9ec
fix out-of-bounds read in bdecode
...
Fixes #2099
2017-06-24 10:52:49 -04:00
arvidn
ed79929528
factor out has_any_file to storage_utils
2017-06-23 16:33:48 -04:00
arvidn
b7642f75d5
move clear_bufs out of storage.cpp into storage_utils
2017-06-21 13:04:05 -04:00
arvidn
f85c01cc0a
merged RC_1_1 into master
2017-06-21 00:51:43 -04:00
arvidn
77cc2b4eea
fix re-check issue after move_storage
2017-06-20 22:27:39 -04:00
Alden Torres
687e0ea4b4
added consts and minor auto refactor in upnp.cpp
2017-06-20 17:59:05 -04:00
Alden Torres
18eef80676
avoid runtime fail with wrong arguments in upnp::update_map ( #2094 )
2017-06-20 15:06:14 -04:00
Alden Torres
f6ca04638c
added const and auto refactor in torrent, piece_picker
2017-06-20 13:20:12 -04:00
arvidn
aa842948a3
storage_params cleanup
2017-06-20 10:27:28 -04:00
arvidn
046bb76361
handle invalid arguments to set_piece_deadline()
2017-06-19 05:46:08 -04:00
arvidn
35491bc476
convert remaining alerts to use operation_t instead of string literal
2017-06-18 22:05:50 -04:00
arvidn
f04d729d43
enforce spell checking on CI
2017-06-18 15:51:51 -04:00
arvidn
ff454a92d4
unify some operation-enums and strings to use operation_t
2017-06-18 07:31:45 -04:00
arvidn
53cbb607d0
first steps towards spell checking documentation
2017-06-17 22:59:57 -04:00
arvidn
ff8703e862
make alert types ABI compatible between builds with deprecated members enabled and without
2017-06-17 16:07:06 -04:00
arvidn
b80c477733
merged RC_1_1 into master
2017-06-16 00:24:41 -04:00
arvidn
a97121d6f2
move_storage did not work for torrents without metadata
2017-06-15 21:20:22 -04:00
arvidn
1fd350cf60
make operation_t an enum class, for type safety
2017-06-15 07:00:06 -04:00
Steven Siloti
a48cdd0281
fix check for fully allocated file on windows
...
The file allocation size is in terms of clusters so it will likely be larger
than the file size even with a freshly allocated file.
2017-06-15 06:36:34 -04:00
arvidn
3f09d16e3c
defer reconnecting peers to after the second_tick loop (to avoid mutating m_connections while iterating over it)
2017-06-14 10:35:50 -04:00
arvidn
3215deb2c5
make io_service::work accounting more accurate in asio-debugging=on
2017-06-14 07:01:06 -04:00
arvidn
9a19ff344b
remove resolve_links disk job left-overs and convert some C-arrays to std::array
2017-06-13 20:35:55 -04:00
Alden Torres
48ef3b6bf7
implemented support for BEP 51 ( #1652 )
2017-06-12 11:54:11 +02:00
arvidn
147d996160
make the job action enum an enum class
2017-06-11 23:53:58 +02:00
arvidn
f3d319b677
fix internal use of deprecated function identify_client
2017-06-10 08:16:23 +02:00
Andrei Kurushin
fc0cbfb789
fix bandwith rate limit calculation ( #2060 )
2017-06-08 12:50:55 +02:00
arvidn
4de9f6a75b
remove requester parameter to disk read jobs
2017-06-08 12:38:25 +02:00
Alden Torres
e38887cb3c
added add_torrent_params.cpp and moved is_nothrow asserts to cpp files ( #2059 )
2017-06-07 16:41:28 +02:00
Alden Torres
b1b3f0e3e8
one more fix related to typed_span conversion ( #2050 )
2017-06-02 06:42:03 +02:00
arvidn
6967d17a42
make move constructors and move assignment operators noexcept
2017-06-01 23:42:15 +02:00
pavel.pimenov
781a35a210
use operator+=(char)
2017-06-01 16:21:27 +02:00
Arvid Norberg
5344761da4
make flags to move_storage a proper enum class ( #2043 )
2017-06-01 04:15:15 -04:00
Alden Torres
c5cdd381da
fixed compilation warnings with newer versions of clang ( #2047 )
2017-06-01 04:12:02 -04:00