Tatsuhiro Tsujikawa
cf8bd76213
2007-11-18 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
...
Removed.
* src/PiecedSegment.{h, cc} (operator==)(operator!=)
Use Segment::operator==()
* src/HttpConnection.cc
* src/Segment.h
Updated usage
* src/version_usage.cc
Added EINTR treatment.
* src/SocketCore.cc
* src/AbstractDiskWriter.cc
Rewritten.
* src/Util.cc (rangedFileCopy)
2007-11-17 17:39:05 +00:00
Tatsuhiro Tsujikawa
048a2cf597
2007-10-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
...
Implemented BitTorrent/http/ftp integrated download.
I've rewritten lots of files and now some headers have forward
class declarations to reduce compile time.
The implementation is extremely alpha stage, I recommend to use this
for testing purpose only.
2007-10-11 16:58:24 +00:00
Tatsuhiro Tsujikawa
54be1cbc4f
2007-08-02 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
...
Merged Dan's patch:
* src/ByteArrayDiskWriter.cc: ios_base -> ios
Use va_copy to avoid core dump on amd64:
* src/SimpleLogger.cc
2007-08-02 14:17:00 +00:00
Tatsuhiro Tsujikawa
6574e44f88
2007-07-21 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
...
Converted int's to in32_t. long long int's are also converted to
int64_t
2007-07-21 08:56:16 +00:00
Tatsuhiro Tsujikawa
2d522cf6b7
2007-06-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
...
Added -j command-line option.
* src/OptionHandlerFactory.cc (createOptionHandlers)
* src/main.cc
* src/ByteArrayDiskWriter.h, src/ByteArrayDiskWriter.cc
Rewritten using stringstream.
* src/TrackerUpdateCommand.h, src/TrackerUpdateCommand.cc
Rewritten using stringstream.
2007-06-09 10:06:53 +00:00
Tatsuhiro Tsujikawa
a37aaa9c0c
2007-03-24 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
...
To add the ability to resume downloading a partially downloaded
file
which is downloaded from the beginning:
* src/FileAllocator.h: Made abstract class. New
DefaultFileAllocator
takes this role.
* src/main.cc: Added -c option.
* src/BitfieldMan.h, src/BitfieldMan.cc (setBitRange): New
function.
* src/DiskWriter.h (openExistingFile): Added totalLength
argument.
* src/prefs.h (PREF_CONTINUE): New definition.
* src/SegmentMan.h, src/SegmentMan.cc (markPieceDone): New
function.
* src/DefaultDiskWriter.cc
(createNewDiskWriter): Add GlowFileAllocator to the new object.
* src/AbstractDiskWriter.h
(glowFileAllocator): New variable.
* src/AbstractDiskWriter.cc
(openExistingFile): Now preallocate file space from the end of
the
existing file if totalLength argument is specified and grater
than 0.
* src/UrlRequestInfo.cc: If -c option is specified and the file
to download exists in local, continue the download of the file.
--allow-overwrite=true is assumed in this context.
* src/DefaultFileAllocator.h, src/DefaultFileAllocator.cc: New
class.
* src/GlowFileAllocator.h, src/GlowFileAllocator.cc: New class.
Throw exception if --check-integrity=true is specified but chunk
checksums are not provided:
* src/UrlRequestInfo.cc
2007-03-24 14:32:49 +00:00
Tatsuhiro Tsujikawa
cd9e35bc63
2007-01-26 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
...
* src/message.h: Added EX_INVALID_PAYLOAD_SIZE and
EX_INVALID_BT_MESSAGE_ID. Following source files affected.
* src/BtAllowedFastMessage.cc:
* src/BtBitfieldMessage.cc
* src/BtCancelMessage.cc
* src/BtChokeMessage.cc
* src/BtHaveAllMessage.cc
* src/BtHaveMessage.cc
* src/BtHaveNoneMessage.cc
* src/BtInterestedMessage.cc
* src/BtNotInterestedMessage.cc
* src/BtPieceMessage.cc
* src/BtPortMessage.cc
* src/BtRejectMessage.cc
* src/BtRequestMessage.cc
* src/BtSuggestPieceMessage.cc
* src/BtUnchokeMessage.cc
* src/message.h: Added EX_INVALID_CHUNK_CHECKSUM. Following
source
files are affected.
* src/ChunkChecksumValidator.cc
* src/SegmentMan.cc
2007-01-25 16:47:29 +00:00
Tatsuhiro Tsujikawa
d28e6aca15
2007-01-11 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
...
To add RecoverableException, FatalException:
* src/AbstractCommand.cc
(onAbort): Exception -> RecoverableException
* src/PeerAbstractCommand.h
(RecoverableException.h): New include.
(onAbort): Exception -> RecoverableException.
* src/PeerInteractionCommand.cc
(onAbort): Exception -> RecoverableException.
* src/PeerAbstractCommand.cc
(execute): Exception -> RecoverableException.
(onAbort): Exception -> RecoverableException.
* src/TorrentRequestInfo.cc
(execute): Exception -> RecoverableException.
* src/MetalinkRequestInfo.cc
(execute): Exception -> RecoverableException.
* src/MetaFileUtil.cc: RecoverableException.
* src/AbstractCommand.h
(onAbort): Exception -> RecoverableException.
* src/DlRetryEx.h: Exception -> RecoverableException.
* src/DlAbortEx.h: Exception -> RecoverableException.
* src/PeerListenCommand.cc: Exception -> RecoverableException.
* src/Util.cc: Exception -> RecoverableException.
* src/DefauldDiskWriter.cc: Exception -> RecoverableException.
* src/TrackerUpdateCommand.cc: Exception ->
RecoverableException.
* src/UrlRequestInfo.cc: Exception -> RecoverableException.
To make ID static const int
* src/BtInterestedMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtPieceMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtChokeMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtHaveAllMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtKeepAliveMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtHandshakeMessage.h
(ID): New variable.
(getId): Made non-const.
* src/BtSuggestPieceMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtPortMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/AbstractBtMessage.h
(id): Removed.
(AbstractBtMessage): Removed id.
(getId): Removed.
* src/BtHaveMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtAllowedFastMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtCancelMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtNotInterestedMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtChokeMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtRejectMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtBitfieldMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtUnchokeMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtRequestMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
* src/BtHaveMessage.h
(ID_t): Removed.
(ID): New variable.
(getId): Made non-const.
To add --force-truncate command-line option and a check whether
the file already exists:
* src/DirectDiskAdaptor.h
(getFilePath): Made virtual public.
* src/MultiDiskAdaptor.h
(File.h): New include.
(DiskWriterEntry::fileEntry): Made private.
(DiskWriterEntry::fileExists): New function.
(DiskWriterEntry::getFileEntry): New function.
(fileExists): New function.
(getFilePath): New function.
* src/TorrentRequestInfo.cc
(FatalException.h): New include.
(message.h): New include.
(RecoverableException.h): New include.
(execute): Added a check whether file is already exists or not.
* src/DiskAdaptor.h
(fileExists): New function.
(getFilePath): New function.
* src/main.cc
(showUsage): Added an explanation of --force-truncate
command-line
option.
(main): Added --force-truncate command-line option.
* src/Exception.h
(setMsg): buf[256] -> buf[1024]
* src/CopyDiskWriter.h
(getFilePath): Made public virtual.
* src/MultiDiskAdaptor.cc: fileEntry -> getFileEntry()
(fileExists): New function.
* src/DownloadEngineFactory.cc
(newTorrentConsoleEngine): Don't open file here.
* src/message.h
(EX_FILE_ALREADY_EXISTS): New definition.
* src/prefs.h
(PREF_FOECE_TRUNCATE): New definition.
* src/HttpResponseCommand.cc
(handleDefaultEncoding): Added a check whether the file already
exists.
* src/SegmentMan.h
(fileExists): New function.
(shouldCancelDownloadForSafety): New function.
* src/FtpNegotiateCommand.cc
(recvSize): Added a check whether the file already exists.
* src/AbstractSingleDiskAdaptor.cc
(File.h): New include.
(fileExists): New function.
* src/AbstractSingleDiskAdaptor.h
(getFilePath): Removed.
(fileExists): New function.
* src/SegmentMan.cc
(fileExists): New function.
(shouldCancelDownloadForSafety): New function.
To fix regression bug in torrent downloading:
* src/DefaultBtRequestFactory.cc
(doChokedAction): New function.
* src/DefaultBtRequestFactory.h
(doChokedAction): New function.
* src/DefaultBtMessageDispatcher.cc
(doChokedAction): Do not delete request if its target is in
allowed
fast set.
* src/DefaultBtInteractive.cc
(doPostHandshakeProcessing): Added a call to
sendPendingMessage().
(sendKeepAlive): Send keep alive message even if the outgoing
message
queue is not empty.
(decideInterest): Simplified the code.
(fillPiece): Remove a call to dispatcher->doChokedAction()
because
it is already called when BtChokeMessage is received from a
peer.
* src/BtRequestFactory.h
(doChokedAction): New function.
To clean up code:
* src/PeerInteractionCommand.h
(executeInternal): Added virtual keyword explicitly.
(prepareForRetry): Added virtual keyword explicitly.
(prepareForNextPeer): Added virtual keyword explicitly.
(onAbort): Added virtual keyword explicitly.
* src/RequestSlot.cc
(isTimeout): Use Time::elapsed() instead of
differenceInMillis().
* src/BtPieceMessage.cc
(doReceivedAction): Added a debug log of piece's bitfield.
* src/Piece.h
(getBitfieldLength): New function.
* src/ByteArrayDiskWriter.cc
(clear): Added buf = 0 to avoid double free corruption.
* src/FileAllocator.cc
(allocate): Fixed an assignment of
fileAllocationMonitor->currentValue.
Added cp.reset().
* src/BitfieldMan.h
(operator=): Rewritten.
* src/BitfieldMan.cc
(BitfieldMan): Initialized bitfield, useBitfield.
* src/PeerConnection.cc
(receiveMessage): Added a call to socket->readable() after
getting
message length to avoid possible EOF.
* src/Util.cc
(torrentUrlencode): Fixed an encodeing bug. BUG#1629912
2007-01-11 16:32:31 +00:00
Tatsuhiro Tsujikawa
3a412f89b2
2007-01-08 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
...
To add an ability to pre-allocate file space:
* src/DirectDiskAdaptor.h: Rewritten.
* src/PieceStorage.h: DiskAdaptor -> DiskAdaptorHandle
* src/MultiDiskAdaptor.h: Rewritten.
* src/DefaultPieceStorage.cc
(MultiDiskWriter.h): Removed include.
(PreAllocationDiskWriter.h): Removed include.
(FileAllocationMonitor.h): New include.
(~DefaultPieceStorage): Removed deletion of diskAdaptor.
(initStorage): Rewritten.
(getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle
* src/FileAllocator.h: New class.
* src/FileAllocator.cc: New class.
* src/FileAllocationMonitor.h: New class.
* src/FileAllocationMonitor.cc: New class.
* src/ConsoleFileAllocationMonitor.h: New class.
* src/ConsoleFileAllocationMonitor.cc: New class.
* src/AbstractSingleDiskAdaptor.h: New class.
* src/AbstractSingleDiskAdaptor.cc: New class.
* src/DiskAdaptor.h
(Directory.h): Removed include.
(DiskWriter.h): Removed include.
(FileEntry.h): Removed include.
(diskWriter): Removed.
(DiskAdaptor): Removed diskWriter.
(openFile): Made pure virtual.
(closeFile): Made pure virtual.
(openExistingFile): Made pure virtual.
(initAndOpenFile): Made pure virtual.
(writeData): Made pure virtual.
(readData): Made pure virtual.
(sha1Sum): Made pure virtual.
(getStoreDir): Returns const reference of storeDir.
(DiskAdaptorHandle): New type definition.
* src/main.cc
(ConsoleFileAllocationMonitor.h): New include.
(showUsage): Added default value description of -s option.
Added the description of --file-allocation option.
(main): Set default value of --file-allocation option to 'none'.
Added --file-allocation command-line option.
Setup FileAllocationMonitorFactory.
* src/FtpInitiateConnectionCommand.cc
(executeInternal): Removed diskWriter related processing, which
was
moved to FtpNegotiationCommand.cc.
* src/DirectDiskAdaptor.cc
(getFilePath): Made non-const.
* src/CopyDiskAdaptor.h
(DiskAdaptor.h): Removed include.
(DiskWriter.h): Removed include.
(AbstractSingleDiskAdaptor.h): New include.
(getFilePath): Made non-const. Added virtual keyword.
(CopyDiskAdaptor): Removed diskWriter.
(getTempFile): Returns const reference.
(CopyDiskAdaptorHandle): New type definition.
* src/ByteArrayDiskWriter.cc
(clear): Simplified.
(initAndOpenFile): Rewritten.
(openFile): Call initAndOpenFile()
* src/MultiDiskAdaptor.cc: Rewritten.
* src/DownloadEngineFactory.cc
(FileAllocator.h): New include.
(FileAllocationMonitor.h): New include.
(newConsoleEngine): Call
DefaultDiskWriter::createNewDiskWriter() to
create DefaultDiskWriter with file allocator.
* src/DiskWriter.h
(initAndOpenFile): Added totalLength argument.
(openFile): Added totalLength argument.
* src/prefs.h
(PREF_FILE_ALLOCATION): New definition.
(V_PREALLOC): New definition.
(V_NONE): New definition.
* src/HttpResponseCommand.cc
(handleDefaultEncoding): Call DefaultDiskWriter::initAndOpenFile
with
size.
* src/FtpNegotiateCommand.cc
(Util.h): New include.
(recvSize): Open file here.
* src/Util.h
(ullitos): New function.
* src/CopyDiskWriter.h
(getFilePath): Made non-const.
* src/DefaultDiskWriter.h
(Option.h): New include.
(totalLength): Removed.
(DefaultDiskWriter): Removed totalLength.
(initAndOpenFile): Added totalLength argument.
(DefaultDiskWriterHandle): New type definition.
(createNewDiskWriter): New function.
* src/Util.cc
(ullitos): New function.
* src/DefaultDiskWriter.cc
(message.h): New include.
(FileAllocator.h): New include.
(prefs.h): New include.
(Util.h): New include.
(DefaultDiskWriter): Removed totalLength.
(initAndOpenFile): Added file allocation.
(createNewDiskWriter): New function. Just for temporary
solution.
It will be rewritten later.
* src/DiskAdaptor.cc
(DiskAdaptor): Removed diskWriter.
* src/AbstractDiskWriter.cc
(LogFactory.h): New include.
(AbstractDiskWriter): Added fileAllocator, logger.
(openFile): Added totalLength argument.
* src/AbstractDiskWriter.h
(FileAllocator.h): New include.
(Logger.h): New include.
(fileAllocator): New variable.
(logger): New variable.
(openFile): Added totalLength argument. Added virtual keyword
explicitly.
(openExistingFile): Added totalLength argument. Added virtual
keyword
explicitly.
(closeFile): Added virtual keyword explicitly.
(sha1Sum): Added virtual keyword explicitly.
(writeData): Added virtual keyword explicitly.
(readData): Added virtual keyword explicitly.
(setFileAllocator): New function.
* src/DefaultPieceStorage.h
(FileAllocator.h): New include.
(diskAdaptor): DiskAdaptor -> DiskAdaptorHandle
(getDiskAdaptor): DiskAdaptor -> DiskAdaptorHandle
* src/FileProgressMonitor.h: New class.
To compile aria2 on PC-BSD:
* src/DefaultBtContext.cc
(libgen.h): New include.
To fix memory leak:
* src/Exception.h
(~Exception): Delete cause. Fixed memory leak.
2007-01-08 00:13:25 +00:00
Tatsuhiro Tsujikawa
1b5af8e829
2006-09-22 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
...
* src/*.{h,cc}:
Added an exception to the license which allows linking with
OpenSSL.
2006-09-21 15:31:24 +00:00
Tatsuhiro Tsujikawa
b1d46227d4
make string type argument const string& where possible
2006-04-19 17:49:03 +00:00
Tatsuhiro Tsujikawa
e199bf8898
To add TrackerUpdateCommand with which replaces
...
CompactTrackerResponseProcessor:
* src/TrackerWatcherCommand.h (req): Removed.
* src/TrackerWatcherCommand.cc (execute): Send a request to
tracker
if the number of peer connections are less than 30.
* src/ByteArrayDiskWriter.h (readData): Implemented.
* src/SegmentMan.h (diskWriter): New function.
* src/SegmentMan.cc (init): Added a call to
diskWriter->closeFile()
* src/main.cc : Removed #include
"CompactTrackerResponseProcessor.h"
(main): Use TrackerUpdateCommand.
* src/TorrentMan.h (CompactTrackerResponseProcessor): Removed.
(req): New variable.
(setTrackerResponseProcessor): Removed.
(getTrackerResponseProcessor): Removed.
(processTrackerResponse): Removed.
* src/DownloadEngine.h (diskWriter): Removed.
* src/TorrentDownloadEngine.cc (afterEachIteration): Removed a
call
to torrentMan->processTrackerResponse().
To add Util::expandBuffer:
* src/ByteArrayDiskWriter.h (expandBuffer): Removed.
* src/ByteArrayDiskWriter.cc (writeData): Use
Util::expandBuffer().
* src/Util.h (expandBuffer): New function.
To fix the bug that causes segmentation fault when "-l ." is
specified
in command-line option:
* src/SimpleLogger.h (SimpleLogger): Removed "filename"
argument.
(openFile): New function.
(closeFile): New function.
* src/SimpleLogger.cc (SimpleLogger): Removed fopen.
(~SimpleLogger): Call closeFile();
* src/LogFactory.cc (getInstance): Added a call to
slogger->openFile().
* src/main.cc (main): Added a check to see logger is configured
properly.
To enable HTTP authentication without specifying
"--http-auth-scheme"
* src/prefs.h (PREF_HTTP_AUTH_ENABLED): New definition.
* src/HttpConnection.cc (createRequest): Send Authorization
header
if PREF_HTTP_AUTH_ENABLED == V_TRUE.
* src/main.cc (main): Preset PREF_HTTP_AUTH_SCHEME to V_TRUE
If "--http-user" is specified, set PREF_HTTP_AUTH_ENABLED to
V_TRUE
* src/Peer.cc (shouldChoke): Updated algorithm.
* src/message.h (EX_AUTH_FAILED): New definition.
(EX_FILE_OPEN): New definition.
* src/HttpResponseCommand.cc (checkResponse): Throw DlAbortEx
if status == 401.
(handleDefaultEncoding): Added a call to
diskWriter->initAndOpenFile()
if req->isTorrent == true.
* src/main.cc (handler): Removed the check to see e->diskWriter
!= NULL
(torrentHandler): Removed the check to see diskAdaptor != NULL.
* src/AbstractDiskWriter.cc (openExistingFile): Updated
messsage.
(createFile): Updated message.
2006-04-19 17:23:58 +00:00
Tatsuhiro Tsujikawa
195aff51ba
2006-04-18 17:28:38 +00:00