Commit Graph

133 Commits

Author SHA1 Message Date
arvidn f4f1425115 use UNC paths pervasively on windows 2019-01-12 21:00:40 +01:00
Alden Torres 6b04c4f642 removed unused file::sparse_end 2019-01-11 02:02:06 +01:00
Alden Torres 94d737ff77 removed unused directory::inode() 2019-01-06 17:21:34 +01:00
arvidn 50ae1838e6 wrap inclusion of windows.h with appropriate defines 2018-11-21 10:09:23 +01:00
Arvid Norberg 3fede4b223 merged RC_1_1 into master 2018-07-08 11:55:32 +02:00
d_komarov 1c86e94de6 Fix deadlock when loading libtorrent Dll
Definition of `bool file::has_manage_volume_privs` involves a call to
`get_manage_volume_privs()`, causing restricted tasks to be performed
from within `DllMain` function. They introduce possibility that client
application deadlocks or crashes.

You should never perform the following tasks from within DllMain:

* Call `LoadLibrary` or `LoadLibraryEx` (either directly or indirectly).
  This can cause a deadlock or a crash.

* Call the registry functions. These functions are implemented in
  'Advapi32.dll'. If not initialized before your DLL, it can access
  uninitialized memory and cause the process to crash.
2018-07-07 18:00:07 +02:00
Steven Siloti 396c5dd3af remove use of deprecated function readdir_r
Ports 140b8ace onto RC_1_1 branch
2018-05-28 16:06:41 +02:00
arvidn f0227451a6 merged RC_1_1 into master 2018-04-13 01:47:41 +02:00
arvidn aaf9304a3b update year in copyright header 2018-04-09 09:04:33 +02:00
arvidn 5413eae900 declare tag types in-line 2018-03-23 11:21:08 +01:00
arvidn 6b55096ebd switch some using declarations to new-style typedefs. remove some redundant parenthesis 2017-09-18 09:38:51 +02:00
Steven Siloti 0232dc35cd deprecate lock_files (#2344)
File locking interacts poorly with the path to replace a read only file handle
with a read/write one. For performance reasons the old handle is not closed
until the new one is put in place. With file locking this obviously cannot
work because the first handle is holding a lock on the file. As a result,
file_pool::open_file fails in this case. Even if we dropped the reference to
the read only file handle before attempting to re-open it, the open could still
fail if another thread is holding a reference to the read only handle.

There doesn't seem to be a good way around this. The simple solution would be
to always open files in read/write mode, but that has obvious safety downsides.
Any other solution would significantly complicate the file pool code.
Deprecating file locking seems to be the least bad option.
2017-09-17 10:43:27 +02:00
Alden Torres cb114a80e1 reverted ino_t cast and added fix only for android 2017-08-04 21:22:20 +02:00
arvidn 6fa181ece8 some cleanup of type-safe flags 2017-07-30 18:20:15 -07:00
Steven Siloti 140b8ace8d remove use of deprecated function readdir_r 2017-07-22 22:40:17 -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 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
arvidn ffaabd846c make file open mode flags be an enum class for type-safety 2017-05-28 11:16:59 -04:00
arvidn 749d0da875 make iovec_t an alias for span<char>, in preparation for removing it altogether in favour of span 2017-04-30 11:49:08 -04:00
arvidn 480bde9333 change formatting of namespace declarations 2017-04-12 14:26:35 -04:00
arvidn 79d7ae3638 separate path and filesystem functions out into its own translation unit/header file pair, separating it from the file and directory class 2017-04-11 18:07:55 -04:00
Arvid Norberg 13b16a63a3 use unsigned type for file flags. make file_pool private to disk_io_thread (#1894)
use unsigned type for file flags. make file_pool private to disk_io_thread. move close_file_interval logic to the disk thread. don't expose file in public interface, and make pool_file_status properly public (not part of file_pool and renamed to open_file_status), this is exposed in public interface via torrent_handle::file_status()
2017-04-08 18:24:50 -04:00
Alden Torres a8b10a7449 more sign warnings fixes (#1775)
more sign warnings fixes
2017-03-09 07:46:52 -05:00
Andrei Kurushin 9bee2146d0 complete UNC path support (#1689)
complete UNC path support. all internal file api functions handle long size paths (> MAX_PATH) and special names (CON,PRN ...) with unit test
2017-02-16 23:47:08 -05:00
Arvid Norberg 3d06371f31 factor out some common storage utilities out of storage.cpp (#1515)
factor out some common storage utilities out of storage.cpp
2017-01-11 00:42:10 -05:00
arvidn d1ea80c2c3 remove disk-access-log build configuration 2017-01-09 08:37:02 -05:00
arvidn 1d1ab4f4b5 removed file-leak code, temporarily used to trouble-shoot files appearing to be left open 2017-01-09 01:43:15 -05:00
Andrei Kurushin 1ec5c69dcd minor code corrections (#1430)
use compact span cast. extend split_path api with only_first_part flag. use single loadlibrary and getprocaddress for IP helper
2016-12-26 22:45:48 -08:00
arvidn 93f400265b revert change to use std::time_t (mingw64 has abi issues) 2016-12-22 01:13:17 -05:00
Alden Torres eaf99aa42b fixed more warnings of shorten-64-to-32 and sign-compare in android (#1425)
fixed more warnings of -Wshorten-64-to-32 in android. changed file_status to use std::time and disable warnings of NLMSG_OK in clang
2016-12-18 10:59:41 -05:00
Steven Siloti ca07ee83a3 mark all converstion to bool operators as explicit 2016-12-12 01:34:36 -05:00
Steven Siloti f5366bd816 use span for scatter/gather lists (#1260)
use span for gather/scatter buffers. remove explicit size parameter from file_op
2016-10-26 20:40:56 -04:00
Arvid Norberg 20f65946f2 make single-argument constructors explicit (#1194)
make single-argument constructors explicit
2016-10-08 14:07:11 -04:00
Alden Torres bf0008933a refactor to use std::shared_ptr with peer_connection, core and tests (#1050) 2016-08-31 21:42:18 -04:00
arvidn 8c8c3d5587 replace boost::function with std::function 2016-08-13 07:07:26 -04:00
Arvid Norberg e36e5efaba use boost::string_ref (#996)
use boost::string_ref/boost::string_view in various parts of the code, in file_storage, some file functions and in bdecode.
2016-08-13 07:04:53 -04:00
Vladimir Golovnev faef995cdc Move storage "file-by-file" (#632)
When moving storage for a torrent, only move files belonging to the torrent, one by one.
2016-06-29 20:05:16 +03:00
Arvid Norberg 6aabe3762b general modernization (#836)
general modernization. use nullptr instead of NULL, use std::tuple instead of boost::tuple, transition some unordered set/map from boost to std. some clean-up of includes
2016-06-20 11:32:06 -04:00
Arvid Norberg ed077c8358 use cstdint intead of boost/cstdint.hpp (#833)
use cstdint intead of boost/cstdint.hpp
2016-06-18 14:01:38 -04:00
Arvid Norberg e8380e1d0b factor out includes from config.hpp into the files actually using it. primarily, printf family of functions, since C++11 version is used now. This removes the need for an snprintf-wrapper on windows (#732) 2016-05-17 09:24:06 -04:00
Arvid Norberg 29902be3a0 some general C++ 11 cleanup. some typedefs and for loops (#709) 2016-05-07 18:46:42 -04:00
Vladimir Golovnev 64cb8b236a Move storage "file-by-file" (#632)
When moving storage for a torrent, only move files belonging to the torrent, one by one.
2016-04-30 22:18:38 -04:00
Arvid Norberg 20b41ad0b9 Threads (#671)
use std::thread, std::mutex, std::condition_variable instead of pulling them in from boost.asio internals.
2016-04-30 18:54:23 -04:00
arvidn 139fb29647 remove unused O_DIRECT mode, and relax/simplify alignment requirements for coalesce_buffers 2016-03-20 00:55:31 -04:00
Alden Torres 5c94b286b0 Removed file::m_path windows specific field
Removed default_storage::sparse_end
Typos
2016-01-21 12:11:33 -05:00
arvidn 1f9f588e75 merge copyright year update and changelog from RC_1_0 2016-01-17 18:57:46 -05:00
Alden Torres 20d8f4e3f7 Removed unused fields in field class 2016-01-11 12:07:36 -05:00
Alden Torres b20096f0db Comments typos 2016-01-02 11:46:10 -05:00
arvidn fb2f2731cf fix support for incomplete reads/writes from disk 2015-11-14 00:21:03 -05:00
Arvid Norberg d43f7b56a2 update copyright year 2015-06-03 05:18:48 +00:00