summaryrefslogtreecommitdiff
path: root/src/BtPieceMessage.cc
Commit message (Collapse)AuthorAgeFilesLines
* Updating upload size and speed must be done separatelyTatsuhiro Tsujikawa2016-01-051-8/+12
|
* make clang-format using clang-format-3.6Tatsuhiro Tsujikawa2015-12-271-113/+99
|
* Fix compile warning with Mingw64 x86 buildTatsuhiro Tsujikawa2015-06-211-1/+1
|
* Use user-defined literal for k, m, and g (powers of 1024)Tatsuhiro Tsujikawa2015-06-211-1/+1
|
* More auto-converts by cpp11-migrateNils Maier2013-09-201-2/+2
|
* Convert to autos and ranged loopsNils Maier2013-08-211-1/+1
|
* Convert most 0/NULL pointers to nullptrNils Maier2013-08-201-3/+3
| | | | Courtesy of llvm cpp11-migrate 3.3
* Use CXX11_OVERRIDETatsuhiro Tsujikawa2013-07-061-1/+1
|
* Use std::unique_ptr instead of array_ptrTatsuhiro Tsujikawa2013-07-031-8/+5
|
* Use std::unique_ptr for ProgressUpdate instead of raw pointerTatsuhiro Tsujikawa2013-07-011-2/+2
|
* Wrap BtMessage objects by std::unique_ptr instead of std::shared_ptrTatsuhiro Tsujikawa2013-06-301-14/+11
|
* Use RequestSlot as pointer to avoid copyingTatsuhiro Tsujikawa2013-06-301-5/+5
|
* Use raw pointers to PieceStorage, PeerStorage and DownloadContxt for BtMessagesTatsuhiro Tsujikawa2013-06-231-5/+5
|
* Require -std=c++11 and use std::shared_ptr instead of SharedHandleTatsuhiro Tsujikawa2013-06-221-10/+10
|
* Revert 9eea959 only the parts which affect src/BtPieceMessage.ccTatsuhiro Tsujikawa2013-06-131-15/+3
| | | | | This is because we are not sure that peer has a piece just sending off its block. It should be notified by the peer.
* Improve peer bitfield and piece stat updateTatsuhiro Tsujikawa2013-06-121-3/+15
| | | | | | On HAVE message reception and PIECE message transmission, update peer bitfield and piece stat only if current peer bitfield indicates it does not have the piece.
* Pack Piece message header and body into one chunkTatsuhiro Tsujikawa2013-01-141-11/+17
|
* Removed BtMessage::isSendingProgress()Tatsuhiro Tsujikawa2013-01-111-2/+0
| | | | | DefaultBtMessageDispatcher::isSendingInProgress() now checks the number of buffer entry in PeerConnection.
* Vectorized write for SocketBuffer to avoid small packetTatsuhiro Tsujikawa2013-01-111-30/+27
|
* Append new data to the contagious cache dataTatsuhiro Tsujikawa2012-12-061-1/+1
| | | | | | 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.
* Clear write cache on Segment::clear and Piece::clearAllBlockTatsuhiro Tsujikawa2012-12-061-10/+3
|
* Added --disk-cache optionTatsuhiro Tsujikawa2012-12-031-25/+43
| | | | | | | | | | 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.
* Use array_ptr to remove try blockTatsuhiro Tsujikawa2012-11-151-8/+6
|
* Get the correct uploaded data sizeTatsuhiro Tsujikawa2012-11-041-5/+14
| | | | | | 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.
* Reworked download/upload statistics calculationTatsuhiro Tsujikawa2012-10-251-0/+2
| | | | | | | | | | | | | | The old implementation calculates download/upload statistics for a RequestGroup by summing up all PeerStat objects. For global statistics, those are summed together. This clearly incurs runtime penalty and we introduced some kind of caching which updates statistics every 250ms but it did not work right. This change removes all these aggregation code, and instead makes RequestGroup and RequestGroupMan objects hold NetStat object and download/upload bytes are directly calculated by thier own NetStat. This is far more simplar than the old way and less runtime penalty and brings more accuracy.
* Removed *Handle typedefTatsuhiro Tsujikawa2012-09-281-3/+3
|
* Made static create function of BtMessage subclass return raw pointerTatsuhiro Tsujikawa2012-09-271-2/+2
|
* Made BtMessage's NAME const char[]Tatsuhiro Tsujikawa2012-09-251-2/+2
|
* Use int64_t instead of off_tTatsuhiro Tsujikawa2012-07-231-6/+9
| | | | | | | | Using off_t, at least, in DiskAdaptor layer is problematic because torrent can contain under 2GiB files but total sum of those files may exceed 2GiB limit, which makes off_t overflow in 32 bit system without large file support. So we use int64_t in API. We'll check the file length before download so that it does not exceed max off_t.
* Use PRId64 for int64_t format specifierTatsuhiro Tsujikawa2012-06-251-2/+2
|
* Rewritten PeerConnection::receiveMessage()Tatsuhiro Tsujikawa2012-06-251-5/+2
| | | | | | | The old implementation calls at least 2 read(2) (4bytes length and payload) to receive the message. This change will read as many bytes as possible in one read(2) call. BtPieceMessage::data_ is now just a const pointer to the internal buffer of PeerConnection.
* Use int instead of unsigned int where unsigned int is not needed.Tatsuhiro Tsujikawa2011-12-091-1/+1
|
* Use int32_t for begin, length in RangeBtMessageTatsuhiro Tsujikawa2011-12-091-14/+11
|
* Ignore peer which possibly sent bad data in next few minuts.Tatsuhiro Tsujikawa2011-12-031-0/+8
| | | | | | | | In aria2, one piece is downloaded from several peers, so when hash check failed for that piece, it cannot determine which peer(s) sent bad data. So, we ignore peer who sent last block of data in random minutes. We use randomized timeout because all peers get waken up at the almost same time.
* Use fmt instead of using snprintf directlyTatsuhiro Tsujikawa2011-11-121-7/+5
|
* Removed strconcatTatsuhiro Tsujikawa2011-11-121-2/+7
|
* Stored hash value as raw byte string, instead of hex digest.Tatsuhiro Tsujikawa2011-10-131-3/+2
|
* Do nothing if block has already acquired.Tatsuhiro Tsujikawa2011-07-161-0/+4
| | | | This happens in end-game mode.
* Renamed MessageDigestHelper as message_digest_helperTatsuhiro Tsujikawa2011-02-051-2/+2
| | | | | Static member variables in MessageDigestHelper class are now functions under message_digest namespace.
* We don't need to call PeerConnection::sendPendingData() twice whenTatsuhiro Tsujikawa2011-01-091-6/+3
| | | | sending piece message.
* 2010-11-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>Tatsuhiro Tsujikawa2010-11-201-9/+9
| | | | | | | | Use format specifier %lld for cuid_t. Defined cuid_t as long long int instead of int64_t, since g++ complains int64_t is not suitable for %lld.
* 2010-11-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>Tatsuhiro Tsujikawa2010-11-201-1/+0
| | | | | | Replaced StringFormat with fmt
* 2010-11-20 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>Tatsuhiro Tsujikawa2010-11-201-62/+48
| | | | | | | Rewritten Logger interface. Logger now writes source file name and line number in log file.
* 2010-11-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>Tatsuhiro Tsujikawa2010-11-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Replaced MessageDigestContext with MessageDigest. Cleaned up unnecessary functions in MessageDigestHelper. * src/BtPieceMessage.cc * src/Checksum.h * src/DHTTokenTracker.cc * src/DownloadCommand.cc * src/DownloadCommand.h * src/HashFuncEntry.h * src/IteratableChecksumValidator.cc * src/IteratableChecksumValidator.h * src/IteratableChunkChecksumValidator.cc * src/IteratableChunkChecksumValidator.h * src/LibgcryptMessageDigestImpl.cc * src/LibgcryptMessageDigestImpl.h * src/LibsslMessageDigestImpl.cc * src/LibsslMessageDigestImpl.h * src/MSEHandshake.cc * src/MSEHandshake.h * src/Makefile.am * src/MessageDigest.cc * src/MessageDigest.h * src/MessageDigestHelper.cc * src/MessageDigestHelper.h * src/MessageDigestImpl.h * src/MetalinkParserController.cc * src/Piece.cc * src/Piece.h * src/UTMetadataDataExtensionMessage.cc * src/bittorrent_helper.cc * src/messageDigest.cc: Removed * src/messageDigest.h: Removed * src/util.cc * src/version_usage.cc * test/BittorrentHelperTest.cc * test/GZipDecoderTest.cc * test/GZipDecodingStreamFilterTest.cc * test/IteratableChecksumValidatorTest.cc * test/IteratableChunkChecksumValidatorTest.cc * test/Makefile.am * test/MessageDigestHelperTest.cc * test/MessageDigestTest.cc * test/Metalink2RequestGroupTest.cc * test/MetalinkProcessorTest.cc * test/PieceTest.cc * test/TestUtil.cc * test/TestUtil.h * test/UTMetadataDataExtensionMessageTest.cc * test/UTMetadataPostDownloadHandlerTest.cc
* 2010-10-28 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>Tatsuhiro Tsujikawa2010-10-281-8/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixed compiler warning about printf format. * src/AdaptiveURISelector.cc * src/BtPieceMessage.cc * src/DHTAbstractNodeLookupTask.h * src/DHTMessageFactoryImpl.cc * src/DHTPeerLookupTask.cc * src/DHTReplaceNodeTask.cc * src/DefaultBtAnnounce.cc * src/DefaultBtInteractive.cc * src/DefaultBtMessageDispatcher.cc * src/DefaultBtProgressInfoFile.cc * src/DefaultBtRequestFactory.cc * src/DefaultExtensionMessageFactory.cc * src/DefaultPieceStorage.cc * src/DownloadCommand.cc * src/FileAllocationCommand.cc * src/FileEntry.cc * src/HandshakeExtensionMessage.cc * src/IteratableChunkChecksumValidator.cc * src/LibgcryptDHKeyExchange.h * src/LibsslDHKeyExchange.h * src/LpdDispatchMessageCommand.cc * src/MSEHandshake.cc * src/MessageDigestHelper.cc * src/MultiDiskAdaptor.cc * src/PeerConnection.cc * src/SegmentMan.cc * src/TimedHaltCommand.cc * src/UTMetadataRequestExtensionMessage.cc * src/UTPexExtensionMessage.cc * src/bencode2.cc * src/bittorrent_helper.cc * src/message.h
* 2010-08-04 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>Tatsuhiro Tsujikawa2010-08-041-1/+2
| | | | | | | | | Don't use pre-calculate hash value when end-game mode. Throw exception if bad piece is received. * src/BtPieceMessage.cc * src/DownloadCommand.cc
* 2010-06-21 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>Tatsuhiro Tsujikawa2010-06-211-38/+38
| | | | | | | Changed naming standards for class member variable: now it looks like var_ instead of _var.
* 2010-06-13 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>Tatsuhiro Tsujikawa2010-06-131-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Renamed member variables * src/ActivePeerConnectionCommand.cc * src/BtLeecherStateChoke.cc * src/BtPieceMessage.cc * src/BtPortMessage.cc * src/BtSeederStateChoke.cc * src/DHTGetPeersReplyMessage.cc * src/DefaultBtInteractive.cc * src/DefaultPeerStorage.cc * src/HandshakeExtensionMessage.cc * src/LpdReceiveMessageCommand.cc * src/Peer.cc * src/Peer.h * src/PeerAbstractCommand.cc * src/PeerInitiateConnectionCommand.cc * src/PeerListenCommand.cc * src/SimpleBtMessage.cc * src/UTPexExtensionMessage.cc * src/XmlRpcMethodImpl.cc * test/DHTAnnouncePeerMessageTest.cc * test/DHTGetPeersMessageTest.cc * test/DHTGetPeersReplyMessageTest.cc * test/DHTMessageFactoryImplTest.cc * test/DHTPeerAnnounceEntryTest.cc * test/DHTPeerAnnounceStorageTest.cc * test/DefaultPeerStorageTest.cc * test/HandshakeExtensionMessageTest.cc * test/LpdMessageReceiverTest.cc * test/PeerListProcessorTest.cc * test/PeerTest.cc * test/UTPexExtensionMessageTest.cc
* 2010-06-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>Tatsuhiro Tsujikawa2010-06-111-97/+131
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Made protected member variable private. Added accessor funcs. * src/AbstractBtMessage.cc * src/AbstractBtMessage.h * src/BtAllowedFastMessage.cc * src/BtAllowedFastMessage.h * src/BtBitfieldMessage.cc * src/BtBitfieldMessage.h * src/BtCancelMessage.cc * src/BtCancelMessage.h * src/BtChokeMessage.cc * src/BtChokeMessage.h * src/BtExtendedMessage.cc * src/BtHaveAllMessage.cc * src/BtHaveAllMessage.h * src/BtHaveMessage.cc * src/BtHaveMessage.h * src/BtHaveNoneMessage.cc * src/BtHaveNoneMessage.h * src/BtInterestedMessage.cc * src/BtInterestedMessage.h * src/BtNotInterestedMessage.cc * src/BtNotInterestedMessage.h * src/BtPieceMessage.cc * src/BtPieceMessage.h * src/BtPortMessage.cc * src/BtPortMessage.h * src/BtRejectMessage.cc * src/BtRejectMessage.h * src/BtRequestMessage.cc * src/BtRequestMessage.h * src/BtUnchokeMessage.cc * src/BtUnchokeMessage.h * src/SimpleBtMessage.cc * src/SimpleBtMessage.h
* 2010-03-21 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>Tatsuhiro Tsujikawa2010-03-211-9/+16
| | | | | | | | Defined cuid_t as int64_t. Removed texts containing "CUID#%D" from translatable texts because it is used in log and debugging purpose.