Commit Graph

14 Commits (2a84b9de43c759fb93aa7a0bb2d22d4b5f37af4e)

Author SHA1 Message Date
Tatsuhiro Tsujikawa 2a84b9de43 2006-04-16 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/TorrentConsoleDownloadEngine.cc
	(onPartialDownloadingCompletes): Renamed as
	onSelectiveDownloadingCompletes.
	(onSelectiveDownloadingCompletes): Updated message.

	To add DiskAdaptor which abstract DiskWriter family:

	* src/PeerConnection.cc: Use diskAdaptor instead of diskWriter.
	* src/PeerInteractionCommand.cc: Use diskAdaptor instead of 
diskWriter.
	* src/BitfieldMan.cc (isAllBitSet): bug fix.
	* src/TorrentMan.cc : Included CopyDiskAdaptor.h, 
DirectDiskAdaptor.h,
	MultiDiskAdaptor.h.
	(readFileEntry): Changed its arguments.
	(setup): setupDiskWriter is merged into this function.
	(setupDiskWriter): Removed.
	(setFileFilter): New function.
	(readFileEntryFromMetaInfoFile): Updated according to the 
changes
	made in readFileEntry.
	(getFilePath): Removed.
	(getTempFilePath): Removed.
	(getSegmentFilePath): Updated due to the removal of getFilePath.
	(fixFilename): Removed.
	(copySingleFile): Removed.
	(splitMultiFile): Removed.
	(deleteTempFile): Removed.
	(setFileEntriesToDownload): Removed.
	(isPartialDownloadingMode): Renamed as 
isSelectiveDownloadingMode.
	(isSelectiveDownloadingMode): New function.
	(setAllMultiFileRequestedState): Removed.
	(finishPartialDownloadingMode): Renamed as
	finishSelectiveDownloadingMode.
	(finishSelectiveDownloadingMode): New function.
	(getPartialTotalLength): Renamed as getSelectedTotalLength.
	(getSelectedTotalLength): New function.
	(onDownloadComplete): Use diskAdaptor.
	* src/MultiDiskWriter.cc (Constructor): Added the argument 
pieceLength
	(Range): Removed.
	(setMultiFileEntries): Renamed as setFileEntries.
	(setFileEntries): New function.
	* src/MultiDiskWriter.h [DiskWriterEntry](enabled): Removed.
	(pieceLength): New variable.
	* src/main.cc (printDownloadCompeleteMessage): New function.
	(torrentHandler): Use diskAdaptor instead of diskWriter.
	(main): Renamed torrent-show-files to show-files.
	Rewritten file contents listing.
	* src/TorrentMan.h (FileEntry): Removed.
	(multiFileTopDir): Removed.
	(multiFileEntries): Removed.
	(diskWriter): Removed.
	(diskAdaptor): New variable.
	* src/DefaultDiskWriter.h (totalLength): New variable.
	* src/DefaultDiskWriter.cc (initAndOpenFile): Added ftruncate.
	* src/TorrentDownloadEngine.cc (onEndOfRun): Use diskAdaptor 
instead of
	diskWriter.
	* src/TorrentConsoleDownloadEngine.h
	(partialDownloadLengthDiff): Renamed as 
selectedDownloadLengthDiff.
	(partialTotalLength): Renamed as selectedTotalLength.
	* src/AbstractDiskWriter.cc (openFile): If file exists, call
	openExistingFile, otherwise call initAndOpenFile.
	(closeFile): fd > 0, not fd != 0.
	
	* src/prefs.h (PREF_TORRENT_SHOW_FILES): Renamed as 
PREF_SHOW_FILES
	(PREF_SHOW_FILES): New definition.
2006-04-16 14:38:19 +00:00
Tatsuhiro Tsujikawa 2f4b3f7d02 2006-04-12 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To add the ability to download multi torrent into respective 
files
	directly:
	
	* src/DiskWriter.h (openFile): New function.
	(seek): Removed.
	* src/MultiDiskWriter.h: New class.
	* src/MultiDiskWriter.cc: New class.
	* src/AbstractDiskWriter.h (seek): Changed its scope from public 
to
	protected.
	(openFile): New function.
	* src/AbstractDiskWriter.cc (openFile): New function.
	* src/prefs.h (V_FALSE): New definition.
	(PREF_DIRECT_FILE_MAPPING): New definition.
	* src/TorrentMan.h (setupDiskWriter): New function.
	(setAllMultiFileRequestedState): New function.
	(onDownloadComplete): New function.
	* src/TorrentMan.cc : Included MultiDiskWriter.h
	(setupDiskWriter): New function.
	(getFilePath): Updated.
	(getTempFilePath): Updated.
	(getSegmentFilePath): Updated.
	(fixFilename): Updated.
	(deleteTempFile): Updated.
	(setAllMultiFileRequestedState): New function.
	(setFileEntriesToDownload): Use setAllMultiFileRequestedState().
	(finishPartialDownloadingMode): Reset requested flags.
	(onDownloadComplete): New function.
	* src/main.cc: Added --direct-file-mapping option.
	Use TorretMan::setupDiskWriter().
	* src/TorrentDownloadEngine.cc (afterEachIteration): Use 
TorrentMan::
	onDownloadComplete().
	
	
	To fix ETA bug:

	* src/Util.h (difftvsec): New function.
	* src/Util.cc (difftvsec): New function.
	* src/TorrentConsoleDownloadEngine.cc (calculateSpeed): Use int 
for the
	type of "elapsed" instead of long long int.
	(calculateStatistics): Use Util::difftvsec instead of 
Util::difftv.
	The updates of statistics takes place every 1 seconds.
	* src/TorrentConsoleDownloadEngine.h (lastElapsed): Changed its 
type.
	(calculateSpeed): Changed its argument signature.
	
	* src/PeerMessage.cc (toString): Fixed message.
2006-04-12 13:55:43 +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 df6c7c0385 added bittorrent support(experimental) 2006-03-21 14:12:51 +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
Tatsuhiro Tsujikawa 28fc3405dd 2006-02-21 15:01:05 +00:00
Tatsuhiro Tsujikawa 8b1c7b0967 2006-02-18 05:21:43 +00:00
Tatsuhiro Tsujikawa 5752a554bf * Added Referer support.
* Added referer command-line option.
	* Added rety-wait command-line option.
	* Fixed formating bug in Exception::setMsg()
2006-02-18 05:13:21 +00:00
Tatsuhiro Tsujikawa 62d3659410 Added Referer support 2006-02-18 03:59:26 +00:00
Tatsuhiro Tsujikawa 2c732211f4 * Added HTTPS support.
* Added SocketCore. Socket is now handle class for SocketCore.
	* Fixed bug in ChunkedEncoding: expanding buffer size is wrong
	* Fixed bug in DownloadCommand: In Chunked Encoding, it wrongly
	adds to Segment.ds buff length from the socket.
2006-02-17 18:51:12 +00:00
Tatsuhiro Tsujikawa 52634627bc Initial import 2006-02-17 13:35:04 +00:00