Commit Graph

2908 Commits (126a4bde612eb0e6c48cf2f13ebe3eac45cc71a8)

Author SHA1 Message Date
Nils Maier b874c7df11 AppleMD: Add destructors to make compilers happy 2013-04-10 08:51:57 +02:00
Nils Maier 9acd3df3cb LibUV: Implement LibuvEventPoll
LibUV event will use the best available polling method on a system, kind
of like aria2 does already with the different *EventPoll
implementations.
However, libuv may support different/newer polling mechanisms; for
example on Windows it will use IO Completion Ports which are superior to
select() ;)
2013-04-10 08:47:20 +02:00
Tatsuhiro Tsujikawa b35fbd3172 Print linked 3rd party libraries with version in `aria2c -v` output 2013-04-10 00:23:39 +09:00
Tatsuhiro Tsujikawa d0ff31faf8 Format MessageDigest.cc 2013-04-09 23:46:25 +09:00
Tatsuhiro Tsujikawa f333231c7a Fix broken MessageDigst::getSupportedHashTypeString() 2013-04-09 23:45:28 +09:00
Tatsuhiro Tsujikawa 15e1a79914 Update TLSSession::checkDirection() doc
Make it clear that TLS_WANT_READ must be returned if underlying
SSL/TLS lib does not indicate I/O direction. This is because
SocketCore sets wantRead_ = true when TLS_WANT_READ is returned and
otherwise sets wantWrite_ = true. We only want to set wantWrite_ =
true iff we have some pending data to send.
2013-04-09 01:12:51 +09:00
Tatsuhiro Tsujikawa 83b801a0a5 Merge branch 'appletls-wantread' of https://github.com/nmaier/aria2 into nmaier-appletls-cred-kc 2013-04-09 01:09:16 +09:00
Nils Maier 16876a5334 AppleTLS: Fixup checkDirection() to return WANT_READ by default 2013-04-08 17:09:32 +02:00
Nils Maier 82a861f8d8 AppleTLS: Support credentials via KeyChain fingerprints 2013-04-08 06:45:53 +02:00
Tatsuhiro Tsujikawa 89cf6c0468 Append comment to endif 2013-04-06 16:34:49 +09:00
Tatsuhiro Tsujikawa 457356ad13 Fix make distcheck 2013-04-06 16:33:15 +09:00
Tatsuhiro Tsujikawa ddad275dbd Make log level INFO in addTrustedCACertFile()
With WARN level, they will be always printed on Mac OS and old GNUTLS
build which does not have its API.
2013-04-06 16:15:32 +09:00
Nils Maier 5709746820 AppleTLS: Block worst ciphers and log session information 2013-04-05 23:31:20 +02:00
Nils Maier 0bcbd947b4 AppleTLS: Implement AppleTLS and Apple Message Digest 2013-04-05 23:10:47 +02:00
Tatsuhiro Tsujikawa b292ae1305 Use info level log for system trusted ca imports failure
This is because on some platforms (gnutls on cygwin for example),
library always fails for this function and getting ERROR every time
aria2c invoked is too hard.
2013-04-05 01:07:43 +09:00
Tatsuhiro Tsujikawa 7ce725098b Remove default value for deprecated --enable-async-dns6 to suppress warning 2013-04-03 02:27:45 +09:00
Tatsuhiro Tsujikawa 8580c98bce Abstract TLS session implementation
Now TLS session object is abstracted as TLSSession class. Currently,
we have GNUTLS and OpenSSL implementations.
2013-04-03 02:24:41 +09:00
Tatsuhiro Tsujikawa 19b5b7e214 Remove deprecated options: --enable-direct-io and --metalink-servers 2013-04-02 00:12:24 +09:00
Tatsuhiro Tsujikawa cd1f1fb56d Deprecate --enable-async-dns6
The IPv6 asynchronous name resolver is enabled if the host has at
least one interface with IPv6 address configured (the loopback address
will not be counted), which is roughly the same behaviour of the
standard getaddrinfo(3). To disable IPv6 asynchronous name resolver,
use --disable-ipv6.
2013-04-02 00:02:56 +09:00
Tatsuhiro Tsujikawa 26972b8535 Rewrite backup connection handling
Now dedicated ConnectCommand handles connection establishment.  It
checks whether connection is established or not.  It also handles
backup connection. The next Command creation is abstracted using
ControlChain struct template.
2013-04-01 23:51:33 +09:00
Tatsuhiro Tsujikawa cf23e3e11d Fix compile error without c-ares 2013-04-01 02:08:53 +09:00
Tatsuhiro Tsujikawa d575e3cc77 Rewrite async DNS portion without exception 2013-04-01 02:03:22 +09:00
Tatsuhiro Tsujikawa 497c1dd8c9 Use AsyncNameResolverMan in NameResolveCommand 2013-04-01 01:56:51 +09:00
Tatsuhiro Tsujikawa 12a3eaf233 Fix uninitialized UDPTrackerClient::numWatchers_ 2013-04-01 01:24:57 +09:00
Tatsuhiro Tsujikawa b5a6c39262 Use AsyncNameResolverMan in DHTEntryPointNameResolveCommand 2013-04-01 01:24:18 +09:00
Tatsuhiro Tsujikawa 597e1a5c1b Implement simple Happy Eyeballs for HTTP/FTP downloads 2013-04-01 00:12:27 +09:00
Tatsuhiro Tsujikawa d671d8bf36 mingw: Ignore tunnel interface and address in 169.254.* 2013-03-31 18:02:46 +09:00
Tatsuhiro Tsujikawa b9fb15f884 Use GetAdaptersAddresses for Mingw 2013-03-31 18:02:46 +09:00
Tatsuhiro Tsujikawa f4a0987544 Check non-loopback (and non-linklocak for IPv6) address is configured
Issue A record query only when non-loopback IPv4 address is
configured.  Likewise, issue AAA record query only when non-loopback
and non-linklocak IPv6 address is configured.
2013-03-31 18:02:45 +09:00
Tatsuhiro Tsujikawa 56fac58b4d Parallel A and AAAA record lookups with c-ares 2013-03-31 18:02:45 +09:00
Tatsuhiro Tsujikawa 5535ed5f95 Code cleanup 2013-03-18 22:45:07 +09:00
Tatsuhiro Tsujikawa d88e815033 Fix bug that invalid range error when requesting range starting 0
Since the change b782a56b, we use endOffsetOverride_ as the return
value of getEndByte(). But aria2 does not send Range header field when
range starts 0 (this is because some server returns error if it
received Range: 0-), and the HttpRequest::isRangeSatisfied() checks
the equality of getEndByte() and the end byte in response header and
fails. The fix is send Range header if getEndByte() is set.
2013-03-18 22:01:36 +09:00
Tatsuhiro Tsujikawa 0fa92911d7 util.cc: Include only signal.h for opensolaris build 2013-03-17 15:42:50 +09:00
Tatsuhiro Tsujikawa 0741a14486 Revert 6b55f5d3 because it breaks opensolaris build 2013-03-17 15:42:16 +09:00
Tatsuhiro Tsujikawa 18ad88088d Fix typo in GZipFile.h spelling 2013-03-16 20:40:39 +09:00
Tatsuhiro Tsujikawa 85de8b0642 Revert DownloadEngine.cc change in 6b55f5d3 because Debian Lenny breaks 2013-03-04 22:32:51 +09:00
Tatsuhiro Tsujikawa 588ee2f1cc GZipFile: Move buf_, buflen_ to initializer list 2013-03-03 22:55:44 +09:00
Tatsuhiro Tsujikawa 43cb2d880a Rewrite GZipFile::vprintf()
MINGW does not have vasprintf(), so we use _vscprintf() and
vsnprintf(). We want to reuse buffer, so for non-MINGW we use
vsnprintf() with retrying doubling buffer size if output is truncated.
2013-03-03 21:49:42 +09:00
Tatsuhiro Tsujikawa e17d0f8d4e Bring back datetime in console log 2013-03-03 18:35:07 +09:00
Tatsuhiro Tsujikawa 66a85777ad Document UDP tracker in manual 2013-03-03 18:28:25 +09:00
Tatsuhiro Tsujikawa baaa3a4fb2 Use IndexedList::remove_if to clean up RequestGroupMan::removeStoppedGroup 2013-03-03 18:08:19 +09:00
Tatsuhiro Tsujikawa d4ba562710 Implement IndexedList::iterator
It is dangerous to expose internal iterator to the outside, which is
easily misused.
2013-03-03 18:00:42 +09:00
Tatsuhiro Tsujikawa 421ae13d40 Run checksum check if -V and -c are used and file is completed
With -c option, aria2 can continue download after the existing file
position. If it is not completed, then after completion aria2 runs
checksum checking if available. But if existing file has already been
completed, then CreateRequestCommand exits without issuing checksum
checking. And aria2 treats it download error because it needs checksum
verification but it has not been done. This change fixes this by
properly checking download state and issue checksum checking before
CreateRequestCommand.
2013-03-03 17:18:12 +09:00
Tatsuhiro Tsujikawa 9b99875478 Add writeOptionLine() to format 1 line of option name/value pair 2013-03-03 14:12:59 +09:00
Tatsuhiro Tsujikawa 6b55f5d393 Do changes in 8aa1db6 in other places which include signal.h 2013-03-03 13:41:03 +09:00
Tatsuhiro Tsujikawa 7c66d1952a Merge branch 'mingw-signal' of https://github.com/nmaier/aria2 into nmaier-mingw-signal 2013-03-03 13:28:51 +09:00
Tatsuhiro Tsujikawa 122e5929c1 SessionSerializer: Remove check fp because it is always true 2013-03-03 13:20:54 +09:00
Tatsuhiro Tsujikawa f4469b79aa SessionSerializer crash when filename length is less than 3 2013-03-03 13:19:52 +09:00
Tatsuhiro Tsujikawa 910e40f128 Fix missing value in serialized pause option 2013-03-03 13:17:49 +09:00
Nils Maier f2f8b14047 Support for gzipped -i and --save-session
Saved sessions may very large, as in hundreds and even thousands of
megabyte when dealing with large queues.
Add support to save and reload sessions to gzipped files, when libz is
available.

The session serializer will output gzipped contents when the file ends
with .gz, while the input file reader (UriListParser) will accept
whatever is thrown at it.
2013-03-02 15:48:26 +01:00
Nils Maier b0556a7519 Do not use a virtual varargs function
This stuff breaks in some compiler (configurations)
2013-03-02 15:48:26 +01:00
Nils Maier 8aa1db682b Check for sys/signal.h and/or signal.h
mingw-w64 does not actually have sys/signal.h, while OSX currently has a
broken signal.h
Better check the presence of both and use sys/signal.h if present, else
signal.h
2013-03-02 15:09:54 +01:00
Nils Maier 7f6a446750 Hygiene: Fix some clang warnings, mostly unused private members. 2013-03-01 13:17:52 +01:00
Nils Maier 62f842579d Fix bustage on OSX with ./configure CC=cc CXX=c++ (clang) 2013-03-01 12:43:40 +01:00
Tatsuhiro Tsujikawa e4bd910d43 Update doc 2013-02-26 23:43:52 +09:00
Tatsuhiro Tsujikawa 704eebfac6 Use std::remove_if 2013-02-26 23:43:20 +09:00
Tatsuhiro Tsujikawa 7f805df4f0 Use std::remove_if 2013-02-26 22:59:28 +09:00
Tatsuhiro Tsujikawa 4ac4fdf1e9 Use same port number for IPv4 and IPv6 DHT 2013-02-26 22:44:19 +09:00
Tatsuhiro Tsujikawa 33037982dc Improve log message for server socket 2013-02-26 22:44:15 +09:00
Tatsuhiro Tsujikawa dfac717dbf Merge branch 'fix-initial-rq-leak' of https://github.com/nmaier/aria2 into nmaier-fix-initial-rq-leak 2013-02-26 21:56:37 +09:00
Nils Maier d1301b8697 Do not reference RequestGroups longer than necessary
There is an initial vector of SharedHandle<RequestGroup> to seed the
DownloadEngine. This vector was however kept alive via main.cc ->
MultiUrlRequestInfo up until the program exits, hence effetively leaking
all initial RequestGroups and associated object instances.

Hence, as a matter of dirty-workaround, drop the contents of that initial
vector as soon as it is not required any longer.
2013-02-26 10:49:24 +01:00
Nils Maier 11b9f3ebe2 Detect console with on Windows
Signed-off-by: Nils Maier <maierman@web.de>
2013-02-25 20:47:43 +01:00
Tatsuhiro Tsujikawa a49397ed19 Fix infinite loop when size of downloadResults_ exceeds maxDownloadResult_ 2013-02-25 21:42:54 +09:00
Tatsuhiro Tsujikawa 2aeb7137d0 Log host and port when unexpected or unknown UDP tracker reply is received 2013-02-25 01:14:27 +09:00
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