Commit Graph

2794 Commits (b292ae1305e8915edd7099446bdd533ac5c4d0a4)

Author SHA1 Message Date
Tatsuhiro Tsujikawa d68741697a Support UDP tracker
It shares UDP listening port with IPv4 DHT. At the moment, in order to
enable UDP tracker support, enable IPv4 DHT.
2013-02-25 00:56:49 +09:00
Tatsuhiro Tsujikawa b782a56b1c Show correct end byte in error message when HTTP response range is not ok
Previously, unless HTTP pipelining is enabled, end byte in that
message is always 0. With this change, it shows correct end byte sent
to the HTTP server.
2013-02-23 15:37:35 +09:00
Tatsuhiro Tsujikawa 73f4db883c Update copyright year in version text 2013-02-21 01:39:08 +09:00
Tatsuhiro Tsujikawa b3acf4d393 Rewrite cookie_helper::reverseDomainLevel() 2013-02-16 22:51:58 +09:00
Tatsuhiro Tsujikawa 61665d2c26 Set sa_mask when setting signal handler 2013-02-14 21:51:30 +09:00
Tatsuhiro Tsujikawa 8e3ae3b76c Use _exit() instead of exit() where appropriate 2013-02-14 01:01:06 +09:00
Tatsuhiro Tsujikawa 3fc45edaa7 Fix bug that active downloads are not saved with --save-session-interval 2013-02-04 21:50:09 +09:00
Tatsuhiro Tsujikawa 98e7018599 Fix failure to set TCP_NODELAY on Windows
On Windows setting TCP_NODELAY after non-blocking connect fails
at least on Windows 7.
2013-02-03 19:09:06 +09:00
Tatsuhiro Tsujikawa 1c9cfccac4 Fix invalid iterator handling when deleting RequestGroup 2013-02-03 18:18:28 +09:00
Tatsuhiro Tsujikawa 85cd65a664 Add debug log for aligned cache write 2013-02-02 21:28:52 +09:00
Tatsuhiro Tsujikawa 561f0b3e29 Use std::deque instead of std::list in IndexedList
We choose faster iteration over rare slower deletion in the middle.
2013-02-01 00:03:47 +09:00
Tatsuhiro Tsujikawa de9697fc47 Fix compiler warning 2013-01-29 21:38:58 +09:00
Tatsuhiro Tsujikawa e583717144 Increase MAX_PEER_LIST_SIZE to 512
We definitely need some tests to determine this value.
2013-01-28 21:36:52 +09:00
Tatsuhiro Tsujikawa 988878930e Check SSL_OP_NO_COMPRESSION is available before using it 2013-01-27 17:32:06 +09:00
Tatsuhiro Tsujikawa a722500d62 Make DefaultPeerStorage::droppedPeers_ distinct 2013-01-26 19:00:03 +09:00
Tatsuhiro Tsujikawa 3a19b65dd7 Rename /BadCondition/ in Peer to /Drop/ 2013-01-26 18:50:48 +09:00
Tatsuhiro Tsujikawa 91b26ab2a8 DefaultPeerStorage::addBadPeer: Updating eoi is not required after erasure 2013-01-26 18:41:43 +09:00
Tatsuhiro Tsujikawa 1e4f301ec1 Remove PeerStorage::getActivePeers() and add getUsedPeers() instead
PeerStorage::getUsedPeers() returns non-active peers, so caller must
call Peer::isActive() to get active peers.
2013-01-26 18:36:09 +09:00
Tatsuhiro Tsujikawa ba69f5c0c3 Refactor peer list management in DefaultPeerStorage
Peer list is now divided into 2: unusedPeers_ and usedPeers_.
Duplicate check is done using std::set by comparing pair of IP address
and port. For this, only IP address and port given to the Peer
constructor are used. In other words, TCP port received from extended
message is not used for this purpose.
2013-01-26 17:50:06 +09:00
Tatsuhiro Tsujikawa 8524ac3806 Code cleanup 2013-01-25 00:10:11 +09:00
Tatsuhiro Tsujikawa de394bbf61 DefaultPeerStorage::addPeer: Remove unnecessary '=' 2013-01-25 00:08:49 +09:00
Tatsuhiro Tsujikawa 550ac8c074 Fix bug returnPeer is not called if sequence_ == INITIATOR_SEND_KEY
In InitiatorMSEHandshakeCommand, when aborting connection, we must
return peer to the PeerStorage. But it is not done if sequence_ is
INITIATOR_SEND_KEY. This causes stale Peer objects whose usedBy()
returns true eventually occupies peer list and aria2 cannot make any
connections.
2013-01-25 00:01:43 +09:00
Tatsuhiro Tsujikawa 32a3c441af Fix bug: wrong parenthesis position in the condition 2013-01-24 00:04:58 +09:00
Tatsuhiro Tsujikawa 3b7566faf1 Rewritten util::uitos() 2013-01-16 23:30:02 +09:00
Tatsuhiro Tsujikawa 1c72b80aa5 Revert 53dde0a9
Reverted to the original strategy, but some values are tweaked.
Without TCP_NODELAY, 53dde0a9 does not work well.
2013-01-15 23:50:12 +09:00
Tatsuhiro Tsujikawa bf4ea63a66 Disable TCP_NODELAY for BitTorrent
To make Request messages more often packed into 1 packet.
2013-01-15 23:17:21 +09:00
Tatsuhiro Tsujikawa e6b0274685 Remove reqNumToCreate constraint when creating request
It really degrades download speed.
2013-01-15 23:07:08 +09:00
Tatsuhiro Tsujikawa df0be5e7f0 Cosmetic change 2013-01-15 21:57:35 +09:00
Tatsuhiro Tsujikawa 88580da587 Remove Append and StringAppend 2013-01-15 21:46:03 +09:00
Tatsuhiro Tsujikawa 6a976a4118 Accept k and m as well as K and M in util::getRealSize() 2013-01-15 21:36:25 +09:00
Tatsuhiro Tsujikawa 851eb137c1 Reverted UB_MAX_OUTSTANDING_REQUEST to 256 2013-01-15 00:33:40 +09:00
Tatsuhiro Tsujikawa 53dde0a9ae Download rate based strategy to increase outstanding request
This strategy performs better than old one in high latency
environment.
2013-01-15 00:02:40 +09:00
Tatsuhiro Tsujikawa d05ef28104 Avoid tiny packet for Have and Request message 2013-01-14 21:02:58 +09:00
Tatsuhiro Tsujikawa d8f5887bbe Increase amount to 24K to pack Piece header and payload; fix missing goto 2013-01-14 21:01:08 +09:00
Tatsuhiro Tsujikawa 63b6075c91 Pack Piece message header and body into one chunk 2013-01-14 18:09:40 +09:00
Tatsuhiro Tsujikawa 36fcccbbdf Reverted accidental change to CHOKE_ROUND_INTERVAL 2013-01-11 23:30:26 +09:00
Tatsuhiro Tsujikawa 1ad815061b Rewritten SpeedCalc 2013-01-11 23:29:58 +09:00
Tatsuhiro Tsujikawa c893d82867 Removed BtMessage::isSendingProgress()
DefaultBtMessageDispatcher::isSendingInProgress() now checks the
number of buffer entry in PeerConnection.
2013-01-11 20:26:31 +09:00
Tatsuhiro Tsujikawa c04df672d1 Buffer up at most A2_IOV_MAX buffer entries for BtMessages 2013-01-11 18:46:36 +09:00
Tatsuhiro Tsujikawa e0ea88ebcf mingw32: Make NTFS sparse file on --file-allocation=trunc 2013-01-11 18:35:54 +09:00
Tatsuhiro Tsujikawa 357e4b1a77 Made SocketCore::readData() and readDataFrom() take void* 2013-01-11 17:03:59 +09:00
Tatsuhiro Tsujikawa 8ba0d58ee1 Vectorized write for SocketBuffer to avoid small packet 2013-01-11 16:50:04 +09:00
Tatsuhiro Tsujikawa 8e63bad2da Added --save-session-interval option
--save-session-interval option saves error/unfinished downloads to a
file specified by --save-session option every SEC seconds. If 0 is
given, file will be saved only when aria2 exits.
2013-01-10 00:15:30 +09:00
Tatsuhiro Tsujikawa 87af7c32c6 Use request URI as referer if --referer="*" is given 2013-01-08 21:42:42 +09:00
Tatsuhiro Tsujikawa 08bed3f77f Log warn if unknown option is found in config file or -i file 2013-01-07 22:42:28 +09:00
Tatsuhiro Tsujikawa d6000024c0 Added --console-log-level option
--console-log-level option sets log level to output to console.
2013-01-05 18:48:09 +09:00
Tatsuhiro Tsujikawa f019eae5df mingw32: Use LANG_ENGLISH for error message 2012-12-27 00:53:22 +09:00
Tatsuhiro Tsujikawa 247084f9c3 Fixed bug that USR_BASENAME is not defined
In some cases, if the dirname is only "/", the basename will not be
defined (e.g., "/f"). This change fixes this bug.
2012-12-27 00:03:37 +09:00
Tatsuhiro Tsujikawa bd671403bc Fix compiler warning 2012-12-26 23:10:32 +09:00
Tatsuhiro Tsujikawa c09a5a95f4 mingw32: Re-open files with read-only mode enabled on seeding
On Mingw32 build, if aria2 opens file with GENERIC_WRITE access right,
some programs cannot open the file aria2 is seeding. To avoid this
situation, re-open files with read-only enabled when seeding is about
to begin.
2012-12-24 23:03:19 +09:00
Tatsuhiro Tsujikawa d13aa3a0b3 Added missing IndexedList.h to SRCS 2012-12-24 21:23:52 +09:00
Tatsuhiro Tsujikawa 616cd9e75f Simplified RequestGroupMan::fillRequestGroupFromReserver 2012-12-22 23:37:44 +09:00
Tatsuhiro Tsujikawa b017e80438 Changed threshold of using upper unit for abbrevSize 2012-12-19 23:58:24 +09:00
Tatsuhiro Tsujikawa 07bb779eb0 Faster deletion of RequestGroup and DownloadResult lists 2012-12-19 23:03:48 +09:00
Tatsuhiro Tsujikawa c8565360b0 Removed unused variables 2012-12-17 00:43:13 +09:00
Tatsuhiro Tsujikawa 77a4ee4de0 Save gid option with --save-session option 2012-12-17 00:33:11 +09:00
Tatsuhiro Tsujikawa 0a4ce4fdb5 Use map to make DownloadResult lookup fast 2012-12-16 18:50:45 +09:00
Tatsuhiro Tsujikawa 0001f4cfbd Added --gid option
This option sets GID manually. aria2 identifies each download by the
ID called GID. The GID must be hex string of 16 characters, thus
[0-9a-zA-Z] are allowed and leading zeros must not be stripped. The
GID all 0 is reserved and must not be used. The GID must be unique,
otherwise error is reported and the download is not added.  This
option is useful when restoring the sessions saved using
--save-session option. If this option is not used, new GID is
generated by aria2.
2012-12-16 18:22:13 +09:00
Tatsuhiro Tsujikawa b9da9d4ed3 Use 64 bits random bytes as GID
This change replaces the current 64 bit sequential GID with 64 bits
random bytes GID in an attempt to support persistent GID. Internally,
the GID is stored as uint64_t. For human representation and RPC
interface, GID is represented as 16 bytes hex string. For console
readout, 16 bytes are too long, so it is abbreviated to first 6 bytes.
When querying GID in RPC calls, user can speicfy the prefix of GID as
long as the prefix is shared by more than 1 GID entries.
2012-12-16 17:29:01 +09:00
Tatsuhiro Tsujikawa 04586f50b1 Fixed BitfieldMan::getOffsetCompletedLength overflow on 32-bit systems 2012-12-16 17:26:01 +09:00
Tatsuhiro Tsujikawa de1ca6d6b8 mingw32: Use HANDLE only for MinGW32 build 2012-12-15 18:28:46 +09:00
Tatsuhiro Tsujikawa 2235743de3 Changed console readout, making it more compact
"SIZE:" is removed because it is obvious. SEEDING, SEED, SPD and UP
are now replaced with SEED, SD, DL and UL respectively.
2012-12-12 23:22:04 +09:00
Tatsuhiro Tsujikawa 4fdd5da27d Compact readout when more than 1 simultaneous downloads are going on
If more than 1 simultaneous downloads are going on, use more compact
format in readout. Currently, at most 5 download stats are displayed.

util::abbrevSize() is rewritten to support "Gi" unit and provides more
compact abbreviation.
2012-12-11 23:40:06 +09:00
Tatsuhiro Tsujikawa 79fce29bda Fixed segmentation fault if fp_ is NULL 2012-12-11 23:39:12 +09:00
Tatsuhiro Tsujikawa e86fd44dc5 Console color output
Log level and download result string is now colored.
2012-12-08 21:48:18 +09:00
Tatsuhiro Tsujikawa 9a5fff0de0 Logger: Simplified console output and change level format in log
The date and time are now removed from console output.  The log level
is now formatted as "[LEVEL]".
2012-12-08 19:13:59 +09:00
Tatsuhiro Tsujikawa 2364f809c3 Code cleanup: Merged successive string literals in readout 2012-12-08 19:09:03 +09:00
Tatsuhiro Tsujikawa bf56f3c299 Check the output file is terminal or not in ctor 2012-12-08 18:38:30 +09:00
Tatsuhiro Tsujikawa 9d7bb9d01a Release statically allocated resources for prefs and options
Not realeasing these resources does not hurt the correctness of the
program, but memory leak detection tool, such as valgrind, reports it
as potential memory leak. It is better to distinguish it from the real
ones.
2012-12-08 17:52:10 +09:00
Tatsuhiro Tsujikawa 901227db9b Updated usage of --disk-cache 2012-12-07 00:44:42 +09:00
Tatsuhiro Tsujikawa 7a02177698 Start to find faster host before the number of missing segments becomes 1
The old implementation starts to find faster host when the number of
missing segment becomes 1. Because of --min-split-size option, before
the number of missing segment becomes 1, the number of connection
becomes 1 and it can be slow. In this case, we have to wait until the
last segment is reached. The new implementation starts to find faster
host when the remaining length is less than --min-split-size * 2, to
mitigate the problem stated above.
2012-12-07 00:32:44 +09:00
Tatsuhiro Tsujikawa 5683f2fb3e Removed unused staticSHA1Digest 2012-12-07 00:12:22 +09:00
Tatsuhiro Tsujikawa bec0f6dc11 Removed warning when --file-allocation=falloc is used in MinGW32 build
The warning was just a mistake. SetFilePointerEx + SetEndOfFile
actually allocate disk space.
2012-12-06 22:48:46 +09:00
Tatsuhiro Tsujikawa a6b18c868b Log size before flush 2012-12-06 03:04:41 +09:00
Tatsuhiro Tsujikawa df5f1fe77f Fixed bug that size_ is not updated when WrDiskCacheEntry::append is called 2012-12-06 03:04:05 +09:00
Tatsuhiro Tsujikawa 838949ab85 Append new data to the contagious cache data
If we receive small data (e.g., 1 or 2 bytes), cache entry becomes a
headache. To mitigate this problem, we allocate cache buffer at least
4KiB and append the data to the contagious cache data.
2012-12-06 02:23:32 +09:00
Tatsuhiro Tsujikawa 2c5e77f422 Flush cached data on checkout/cancel Segment
This change prevents the cached data from overlap because of BT peers.
2012-12-06 01:16:28 +09:00
Tatsuhiro Tsujikawa 56c498bcbf Clear write cache on Segment::clear and Piece::clearAllBlock 2012-12-06 00:39:14 +09:00
Tatsuhiro Tsujikawa 9ed8502e74 Write data in 4K aligned offset in write with disk cache enabled
This greatly reduces disk activity especially on Win + NTFS.  Not so
much difference on Linux.
2012-12-06 00:17:11 +09:00
Tatsuhiro Tsujikawa 911851debb mingw32: Removed FSCTL_SET_SPARSE set 2012-12-03 23:07:05 +09:00
Tatsuhiro Tsujikawa f314719618 Added --disk-cache option
This option enables disk cache. If SIZE is 0, the disk cache is
disabled. This feature caches the downloaded data in memory, which
grows to at most SIZE bytes. The cache storage is created for aria2
instance and shared by all downloads. The one advantage of the disk
cache is reduce the disk seek time because the data is written in
larger unit and it is reordered by the offset of the file. If the
underlying file is heavily fragmented it is not the case.
2012-12-03 01:39:10 +09:00
Tatsuhiro Tsujikawa 8ac433a8e9 Fixed compile error without SSL/TLS lib 2012-12-01 23:37:57 +09:00
Tatsuhiro Tsujikawa 2cbdd8b845 Fixed compile error without BitTorrent support 2012-12-01 21:33:25 +09:00
Tatsuhiro Tsujikawa 7e59e2dbb5 mingw32: Open file using _wsopen and added --enable-mmap support
I tried CreateFile but the subsequent ReadFile fails with Access
Denied if sparse file is read on NTFS. I mostly reverted previous
changes and use _wsopen with read/write share enabled instead of
CreateFile.

This change also includes --enable-mmap support for MinGW32
build. Memory mapped file may be useful for 64-bits OS and lots of
RAM. Currently, FlushViewOfFile is not called during the download, so
it is slightly vulnerable against sudden power loss. I found lots of
read when resuming download due to page fault. So for now it is useful
for the initial download. I recommend not to use
--file-allocation=prealloc with --enable-mmap for MinGW32, because it
triggers page faults even in the initial download. Anyway, the option
is experimental.
2012-12-01 19:38:30 +09:00
Tatsuhiro Tsujikawa b95f15b462 Use Win32 API for file I/O in AbstractDiskWriter
Now file has been opened by aria2 is now readable by other processes.
2012-11-30 01:20:49 +09:00
Tatsuhiro Tsujikawa 74520b03f8 Set F_GLOBAL_NOCACHE for Mac OS X 2012-11-28 21:47:55 +09:00
Tatsuhiro Tsujikawa 506a9358e1 Refactored file open code 2012-11-28 21:46:44 +09:00
Tatsuhiro Tsujikawa 16e25ef4e1 Enabled TCP_NODELAY in SocketCore::establishConnection and acceptConnection 2012-11-28 00:20:43 +09:00
Tatsuhiro Tsujikawa e781e6eac1 Made socket non-blocking mode in SocketCore::beginListen() 2012-11-28 00:15:03 +09:00
Tatsuhiro Tsujikawa 438f95abae Made socket non-blocking mode in SocketCore::acceptConnection() 2012-11-28 00:10:32 +09:00
Tatsuhiro Tsujikawa e0dcb942b2 Added --force-save option.
--force-save option saves download with --save-session option even if
the download is completed or removed. This may be useful to save
BitTorrent seeding which is recognized as completed state.  The
default value is false.
2012-11-17 15:33:44 +09:00
Tatsuhiro Tsujikawa 2ee4361848 Removed unused static function util::parseParam 2012-11-17 14:38:55 +09:00
Tatsuhiro Tsujikawa 9c1fe4addd Use array_ptr to remove try block 2012-11-15 22:05:59 +09:00
Tatsuhiro Tsujikawa 6b2f5ab1f5 SocketCore::bind now accepts const char* host instead of std::string 2012-11-15 21:09:10 +09:00
Tatsuhiro Tsujikawa b2893f1e31 Get the correct uploaded data size
Subtract msgHdrLen_ from writtenLength to get the uploaded data size.
Without this correction, the seeder assumes it has uploaded more data
than it actually has.
2012-11-04 16:49:39 +09:00
Tatsuhiro Tsujikawa 31189b1222 Made return type of util::parse_content_disposition ssize_t 2012-11-01 22:54:32 +09:00
Tatsuhiro Tsujikawa 08cd68ec95 Removed Socket.h from SRCS 2012-10-31 19:07:08 +09:00
Tatsuhiro Tsujikawa bf342a2827 Fixed compile error with mingw 2012-10-31 17:10:49 +09:00
Tatsuhiro Tsujikawa d4e7b51eb9 Made --http-no-cache false by default 2012-10-31 16:44:28 +09:00
Tatsuhiro Tsujikawa 49e9f66c16 Use len formal parameter of util::parse_content_disposition 2012-10-31 01:24:10 +09:00