Commit Graph

4318 Commits (644a74da012900be6a3c83d0a1eecd62343c9415)

Author SHA1 Message Date
Tatsuhiro Tsujikawa f3096f8cd8 renamed TorrentMan::deltaUpload to TorrentMan::deltaUploadLength 2006-03-31 15:34:27 +00:00
Tatsuhiro Tsujikawa eb3103933b renamed TorrentMan::deltaDownload to TorrentMan::deltaDownloadLength 2006-03-31 15:30:37 +00:00
Tatsuhiro Tsujikawa f02143579b renamed TorrentMan::totalSize to TorrentMan::totalLength and added its
accessors.
2006-03-31 15:27:21 +00:00
Tatsuhiro Tsujikawa 180153592d rename TorrentMan::preUploadedSize to TorrentMan::preUploadLength 2006-03-31 15:11:17 +00:00
Tatsuhiro Tsujikawa 6214190108 rename TorrentMan::preDownloadedSize to TorrentMan::preDownloadLength 2006-03-31 15:08:21 +00:00
Tatsuhiro Tsujikawa b99ff98e40 rename TorrentMan::uploadedSize to TorrentMan::uploadLength 2006-03-31 15:05:08 +00:00
Tatsuhiro Tsujikawa 8b94be7475 rename TorrentMan::downloadedSize to TorrentMan::downloadLength 2006-03-31 14:58:36 +00:00
Tatsuhiro Tsujikawa 133f759a0d make socket parameter in *Command contructor const 2006-03-31 14:46:48 +00:00
Tatsuhiro Tsujikawa e6e0177560 * src/PeerInteractionCommand.cc (checkInactiveConnection): New
function
	(detectMessageFlooding): Updated.
	(checkLongTimePeerChoking): Updated.
	(getNewPieceAndSendInterest): Added debug log.
	* src/PeerInteractionCommand.h: New function 
checkInactiveConnection()
	
	* src/TorrentMan.cc (deleteOldErrorPeers): Updated.
	(getPeer): Updated.
	* src/TorrentMan.h: Added MAX_PEER_ERROR.
	
	* src/PeerAbstractCommand.cc (onAbort): Increment error counter.

	* src/PeerListenCommand.cc (execute): Close connection if 
incoming peer
	is localhost.

	* src/main.cc (main): Updated PREF_PEER_CONNECTION_TIMEOUT to 
60.

	* src/PendingMessage.cc (processMessage): Not to send piece 
message
	if peer is not interested in the pieces localhost has.

	* src/Peer.cc (shouldChoke): Updated.

	* src/SendMessageQueue.cc (cancelAllRequest): Fixed.
2006-03-31 13:58:22 +00:00
Tatsuhiro Tsujikawa e1f24adc40 Added new class SendMessageQueue that includes PendingMessages
and
	RequestSlotMan.

	* src/SendMessageQueue.h: New class.
	* src/SendMessageQueue.cc: New class.
	* src/PendingMessage.h: Added new member variable blockIndex and 
its
	accessors.
	(createRequestMessage): Updated.
	* src/PendingMessage.cc (createRequestMessage): Updated.
	* src/PeerInteractionCommand.cc (executeInternal): Updated with
	SendMessageQueue.
	(checkLongTimePeerChoking): Updated with SendMessageQueue.
	(receiveMessage): Updated with SendMessageQueue.
	(deletePendingPieceMessage): Removed.
	(getNewPieceAndSendInterest): Updated with SendMessageQueue.
	(sendInterest): Updated with SendMessageQueue.
	(createRequestPendingMessage): Updated with SendMessageQueue.
	(sendMessages): Updated with SendMessageQueue.
	(onAbort): Updated with SendMessageQueue.
	(keepAlive): Updated with SendMessageQueue.
	(beforeSocketCheck): Updated SendMessageQueue.

	* src/PeerInteractionCommand (sendMessages): Shuffle
	missingBLockIndexes before using it.
	
	Added its own timeout for peer connection.
	
	* src/PeerAbstractCommand.h: Added member variable timeout and 
its
	setter.
	* src/prefs.h: Added PREF_PEER_CONNECTION_TIMEOUT.
	* src/PeerInteractionCommand.cc (PeerInteractionCommand):
	Added setTimeout() call.
	(executeInternal): Added setTimeout() call.
	* src/PeerAbstractCommand.cc (PeerAbstractCommand):
	Added timeout.
	(isTimeoutDetected): Updated.
	* src/main.cc (main): Added PREF_PEER_CONNECTION_TIMEOUT entry 
to
	option.
	
	Added *simple* message flooding checker.
	
	* src/PeerInteractionCommand.cc (executeInternal):
	Added detectMessageFlooding() call.
	(detectMessageFlooding): New function.
	(receiveMessage): Count up CHOKE, UNCHOKE, HAVE message.
	(beforeSocketCheck): Added detectMessageFlooding() call.
	* src/PeerInteractionCommand.h: Added sendMessageQueue,
	chokeUnchokeCount, haveCount, detectMessageFlooding().
	Removed deletePendingPieceMessage(), getRequestSlot(),
	deleteRequestSlot(), deleteAllRequestSlot().
	
	* src/PeerInteractionCommand.cc (beforeSocketCheck):
	Added checkLongTimePeerChoking() call.

	* src/RequestSlotMan.h: Renamed deleteTimeoutRequestSlot().

	* src/TorrentMan.cc (addPeer): Delete at most MAX_PEER_LIST_SIZE 
peers
	if duplicate == false.

	The parameter "uploaded" and "downloaded" in the tracker request 
are
	the size since the client sent the "started" event to the 
tracker.
	
	* src/TorrentMan.cc (setup): Assigned saved downloaded Size and
	uploaded size to preDownloadedSize, preUploadedSize 
respectively.
	* src/TorrentMan.h: Added preDownloadedSize, preUploadedSize,
	getSessionDownloadedSize(), getSessionUploadedSize().
	* src/TrackerInitCommand.cc (execute): Use 
getSessionDownloadedSize(),
	getSessionUploadedSize() instead of getDownloadedSize(),
	getUploadedSize().
	
	* src/PendingMessage.cc (processMessage): Do not send request 
message
	if the peer is choking the client.

	* src/TrackerUpdateCommand.cc (execute): Check wtheher 
minInterval is
	less than interval.
2006-03-28 15:23:51 +00:00
Tatsuhiro Tsujikawa 4892b40945 2006-03-27 14:48:00 +00:00
Tatsuhiro Tsujikawa 40cb1ca9ce 2006-03-27 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* configure.in: Added gnutls support. Added several CPP macros.
	* m4/openssl.m4: Added.
	* src/SocketCore.{h,cc}: Drop const quarifier from writeData(),
	readData(), peekData(). Added gnutls support.
	* src/HttpDownloadCommand.cc: Removed SleepCommand.h
	* src/TrackerWatcherCommand.{h,cc}: Added. This command creates
	TrackerInitCommand periodicaly(TorrentMan::minInterval).
	* src/TorrentMan.cc: Remove downloadedSize == 0 check from 
save().
	Instead, added a check for whether setup method has executed
	successfully.
	* src/TorrentMan.h: Added member vaiable setupComplete. Updated
	DEFAULT_ANNOUNCE_INTERVAL and DEFAULT_ANNOUNCE_MIN_INTERVAL to 
300.
	* src/Makefile.am: Updated.
	* src/messageDigest.h: Added. This is a macro calculating SHA1 
digest
	using whether OpenSSL or gcrypt, depending on the result of 
configure
	script.
	* src/ShaVisitor.{h,cc}: Removed direct	dependency on OpenSSL by 
using
	messageDigest.h. 
	* src/TorrentAutoSaveCommand.h: Removed unused variable cuid.
	* src/PeerListenCommand.cc: Added log about port binded 
successfully.
	Fixed memory leak.
	* src/main.cc: Added gnutls support. Replaced LIB_SSL with
	ENABLE_BITTORRENT where they are not related to OpenSSL but 
BitTorrent.
	Removed instantiation of TrackerInitCommand. Instead,
	TrackerWatcherCommand is instantiated and pushed to the command 
queue.
	* src/InitiateConnectionCommandFactory.cc: Replaced HAVE_LIBSSL 
with
	ENABLE_SSL.
	* src/Request.cc: Replaced HAVE_LIBSSL with ENABLE_SSL.
	* src/RequestSlotMan.cc:
	(deleteCompletedRequestSlot)
	If a piece is already acquired by another command, delete the 
request
	slots for the piece.
	* src/TrackerUpdateCommand.cc:
	(execute)
	Changed log level of MSG_TRACKER_WARNING_MESSAGE from info to 
warn.
	Added a check whether peer list is null.
	Fixed the bug that causes sending completed event to the tracker
	several times.
	* src/TrackerInitCommand.cc:
	(execute)
	Fixed the bug that causes sending completed event to the tracker
	several times.
	* src/AbstractDiskWriter.{h,cc}: Removed direct dependency on 
OpenSSL
	by using messageDigest.h.
	
	
2006-03-26  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>

	* PeerConnection.cc: Replaced log message "keep-alive" with
	"keep alive".
	* PeerInteractionCommand.{h,cc}: Close connection if peer is 
choking
	localhost long time.
	* TorrentMan.cc: When adding new peer with duplicate = true, if 
the
	number of peer list is equal to or grater than MAX_PEER_LIST, 
delete
	at most 100 failure entry from the list. If with duplicate = 
false,
	MAX_PEER_LIST is not checked.
	* PeerListenCommand.cc: Fixed the argument order of log message.

2006-03-25  Tatsuhiro Tsujikawa  <tujikawa at rednoah dot com>

	* Logger.h: Moved enum LEVEL from SimpleLogger.h to here.
	Added warn().
	* SimpleLogger.h: Moved enum LEVEL to Logger.h.
	Implemented warn().
	Defined 2 macros(WRITE_LOG, WRITE_LOG_EX) to avoid duplicated 
code.
2006-03-27 14:47:26 +00:00
Tatsuhiro Tsujikawa 2065b049ab * Request.h: Added AFTER_COMPLETED event.
* TorrentDownloadEngine.cc: Prints "Download complete" message
	instead of downloaded size and progress(%) after download 
completes.
	* PeerInteractionCommand.cc: After download completes, sends 
unchoke
	message to the peer if it is interested in what localhost has
	downloaded.
	* TorrentMan.cc: In single-file mode, copy temporary file to the 
final
	destination instead of just renaming it.
	* TorrentMan.cc: Added deleteTempFile().
	* PeerAbstractCommand.cc: do not stop execution after download
	completes. This makes localhost a seeder.
	* Util.{h,cc}: Added fileCopy().
	* PeerListenCommand.cc: do not stop execution after download 
completes.
	This makes localhost a seeder.
	* main.cc: Do not call TorrentMan::fixFilename() in 
torrentHandler.
	Added TorrentMan::deleteTempFile() to torrentHandler.
	Initialized the variable dir as ".".
	* TorrentMan.h: Changed DEFAULT_ANNOUNCE_INTERVAL to 120 
seconds.
	Deleted renameSingleFile().
	Added copySingleFile(), deleteTempFile().
	* DownloadEngine.h: Added virtual function afterEachIteration().
	* TorrentDownloadEngine.cc: Move a call to 
TorrentMan::fixFilename()
	in onEndOfRun() to afterEachIteration().
	In onEndOfRun(), changed if condition to check whether 
filenameFixed is
	true.
	* Util.cc: Implemented fileCopy() using rangedFileCopy().
	In rangedFileCopy(), added try-catch block to properly close 
file
	descriptors.
	* TorrentDownloadEngine.cc: Added a member variable 
filenameFixed.
	Added afterEachIteration(), isFilenameFixed().
	* Peer.cc: Changed choking strategy.
	* PreAllocationDiskWriter.cc: Drop O_DIRECT flag.
	* TrackerInitCommand.cc: Send completed event only once.
	* DownloadEngine.cc: Added a call to afterEachIteration().
	* TrackerUpdateCommand.cc: Do not stop execution after download
	completes.
	* TorrentMan.h: Defined MAX_PEER_UPDATE as 15. aria2 attempts to
	connect the peers at most MAX_PEER_UPDATE when a peer list is
	received from a tracker.
	* TrackerUpdateCommand.cc: Implemented above mentioned behavior.
	Decreased the number of failure peers to delete to 0(just 
comment out
	the line).
	* Release 0.3.1
2006-03-24 11:59:18 +00:00
Tatsuhiro Tsujikawa be44f3a736 * main.cc: corrected addCommand. 2006-03-23 11:04:43 +00:00
Tatsuhiro Tsujikawa 1fcd640d3b * AbstractCommand.cc: casted timeout value to long long int.
* ChunkedEncoding.cc: fixed memory leak.
	* PeerInteractionCommand.cc: casted timeout value to long long 
int.
	* SleepCommand.cc: casted timeout value to long long int.
	* Data.cc: fixed memory leak.
	* Data.cc: fixed toLLInt().
	* BitfieldMan.cc: fixed memory leak.
	* TorrentMan.cc: initialized storeDir to ".".
	* TorrentMan.cc: fixed memory leak.
	* TorrentMan.cc: corrected file paths of splitted files.
	* PeerAbstractCommand.cc: casted timeout to long long int.
	* main.cc: added delete(req) and delete(te->diskWriter).
	* RequestSlot.cc: casted timeout value to long long int.
	* Request.cc: fixed memory leak.
	* PendingMessage.cc: make HAVE messages sent only when peer does 
not
	have the piece.
	* Peer.{h,cc}: added hasPiece(int index).
2006-03-23 10:47:25 +00:00
Tatsuhiro Tsujikawa 198b87fa3e * replaced std::vector with std::deque. 2006-03-22 16:21:11 +00:00
Tatsuhiro Tsujikawa 26aa28acb3 * PeerInteractionCommand.cc: added a call to
TorrentMan::unadvertisePiece in Destructor.
	* PeerInteractionCommand.cc: make have message sent immediately
	if the size of pending message queue is zero.
	* TorrentMan.cc: set the maximum size of peer list to 250.
	* TorrentMan.h: changed the container type of Peers and 
UsedPieces
	to deque.
	* Util.cc: fixed rangedFileCopy.
	* AbstractDiskWriter.{h,cc}: moved digest context initialization
	to Constructor. Also, moved digest cleanup to Destructor.
	* MetaFileUtil.cc: fixed memory leak
2006-03-22 15:10:03 +00:00
Tatsuhiro Tsujikawa bf336caa83 2006-03-21 17:59:10 +00:00
Tatsuhiro Tsujikawa 5fa0272558 2006-03-21 17:35:06 +00:00
Tatsuhiro Tsujikawa 8ad0037ee2 2006-03-21 17:28:57 +00:00
Tatsuhiro Tsujikawa 4b6181b6d1 2006-03-21 16:54:42 +00:00
Tatsuhiro Tsujikawa 01118364a5 2006-03-21 16:07:22 +00:00
Tatsuhiro Tsujikawa 29374cd70c 2006-03-21 15:21:11 +00:00
Tatsuhiro Tsujikawa df6c7c0385 added bittorrent support(experimental) 2006-03-21 14:12:51 +00:00
Tatsuhiro Tsujikawa a59301bef0 * ChunkedEncoding.{h,cc}: fixed the bug that if chunk data is binary,
decoding did not work properly.
2006-03-09 14:52:07 +00:00
Tatsuhiro Tsujikawa 2a1b2c8ab4 2006-03-07 13:58:29 +00:00
Tatsuhiro Tsujikawa a102282ae6 Deleted m4/Makefile, po/Makefile 2006-03-07 13:52:36 +00:00
Tatsuhiro Tsujikawa fc7f34bc1a 2006-03-07 13:33:43 +00:00
Tatsuhiro Tsujikawa 46354b7c91 Added intl/*
Added src/alloca.c
2006-03-07 13:08:09 +00:00
Tatsuhiro Tsujikawa 8d980589e3 2006-03-05 06:32:01 +00:00
Tatsuhiro Tsujikawa 0276b3bb37 * DownloadEngine.{h, cc}:
* ConsoleDownloadEngine.{h, cc}: Console output message(size, 
speed)
	is now generated by ConsoleDownloadEngine not by DownloadEngine.
	* main.cc: Download complete/abort message is now generated by 
main.
	* Makefile.am (SUBDIRS): Add m4.
	(ACLOCAL_AMFLAGS): New variable.
	(EXTRA_DIST): New variable.
	* configure.in (AC_CONFIG_FILES): Add po/Makefile.in,
	* gettext: added gettext functionality
2006-03-02 10:43:00 +00:00
Tatsuhiro Tsujikawa 0f6d2fd451 * DownloadEngine.{h, cc}:
* ConsoleDownloadEngine.{h, cc}: Console output message(size, 
speed)
	is now generated by ConsoleDownloadEngine not by DownloadEngine.
	* main.cc: Download complete/abort message is now generated by 
main.
2006-03-02 02:54:49 +00:00
Tatsuhiro Tsujikawa bea6e0e016 2006-03-01 15:28:31 +00:00
Tatsuhiro Tsujikawa 44e1dafe7b * HttpConnection.cc:
* common.h: defined the user agent name as macro
2006-03-01 15:28:03 +00:00
Tatsuhiro Tsujikawa c9f8c076c3 2006-03-01 08:28:57 +00:00
Tatsuhiro Tsujikawa 293c33ccef 2006-03-01 08:22:40 +00:00
Tatsuhiro Tsujikawa a8f0186af2 2006-03-01 08:12:01 +00:00
Tatsuhiro Tsujikawa 726e14aa81 2006-03-01 07:55:09 +00:00
Tatsuhiro Tsujikawa 4a5fa077b3 * ChunkedEncoding.cc: Added #include directive for strings.h 2006-03-01 07:46:21 +00:00
Tatsuhiro Tsujikawa dd26d75751 * Logger.h:
* SimpleLogger.{h,cc}: Changed the type of msg to const char*.
2006-03-01 07:14:52 +00:00
Tatsuhiro Tsujikawa 583e09780b * HttpConnection.cc: Added "Proxy-Connection" header to proxy
request.
	Added "User-Agent" header to CONNECT proxy request.
	Fixed "Proxy-Authorization" header. Now proxy authorization 
works
	properly.
2006-03-01 07:00:39 +00:00
Tatsuhiro Tsujikawa bc1cf6ed2d * AbstractCommand.cc:
* DownloadCommand.{h, cc}: Aborted downloading commands now 
properly
	unregister its cuid from SegmentMan.	
	* DownloadEngine.cc: .aria2 file was written when a downloading
	failed with errors.
2006-03-01 02:26:29 +00:00
Tatsuhiro Tsujikawa d770d1c40a * common.h: defined LONG_LONG_MAX and LONG_LONG_MIN if a
compiler
	does not define these macros.
2006-02-28 03:09:22 +00:00
Tatsuhiro Tsujikawa 20ba8c707a * Util.{h,cc}: added startsWith().
* CookieBox.cc: rewrited criteriaFind() using Util::startsWith() 
and
	Util::endsWith().
	* SocketCore.cc: struct addrinfo is now  zero-initialized.
	* common.h: added #include directive of limit.h.
	* DownloadEngine.cc: added #include directive of sys/time.h and
	algorithm.
	* Exception.h: added #include directive of stdio.h.
	* AbstractCommand.h: added #include directive of sys/time.h.
	* DownloadCommand.h: added #include directive of sys/time.h.
	* *.h: added #include directive of common.h to all base classes.
	subclasses' one was removed.
2006-02-28 02:25:45 +00:00
Tatsuhiro Tsujikawa 87a229cab1 Update configure.in to add inet_ntoa to AC_CHECK_FUNCS 2006-02-22 15:54:19 +00:00
Tatsuhiro Tsujikawa cd5f591c41 2006-02-22 15:40:04 +00:00
Tatsuhiro Tsujikawa 5a624f5a3d new 2006-02-22 14:31:33 +00:00
Tatsuhiro Tsujikawa 2462a3b06c 2006-02-22 14:30:47 +00:00
Tatsuhiro Tsujikawa 27d392d5f2 2006-02-22 12:16:10 +00:00
Tatsuhiro Tsujikawa ebdb4b86cf 2006-02-22 11:18:47 +00:00