diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2006-07-30 12:58:27 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2006-07-30 12:58:27 +0000 |
| commit | 928465b7bc638380004b39d6a5c6737f9f30faa0 (patch) | |
| tree | 004af049ff7254834f42cacbf552558d1de1f08e /src/HaveEraseCommand.cc | |
| parent | ba4e5b776be3816eb695a125d5f4f0406c74c55b (diff) | |
2006-07-30 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
* src/TorrentMan.h:
(advertisePiece): Updated doc.
(getAdvertisedPieceIndexes): Updated doc.
(removeAdvertisedPiece); New function.
* src/TorrentMan.cc
(FindElapsedHave): New function object.
(removeAdvertisedPiece): New function.
* src/HaveEraseCommand.h: New class.
* src/HaveEraseCommand.cc: New class.
* src/FeatureConfig.h: New class.
* src/FeatureConfig.cc: New class.
* src/Request.h
(defaultPorts): Removed.
* src/Request.cc
(FeatureConfig.h): Included.
(Request): Removed the statements related to defaultPorts.
(parseUrl): Removed metalinkEnabled. Use FeatureConfig instead.
A default port number is now retrieved from FeatureConfig.
* src/main.cc
(HaveEraseCommand.h): Included.
(showVersion): Added the output of feature list.
(main): Added HaveEraseCommand to command queue in BitTorrent
downloading.
* src/PeerInteractionCommand.h
(chokeCheckPoint): Commented out.
(periodicExecPoint): New variable.
* src/PeerInteractionCommand.cc
(executeInternal): Following methods are now called in at least
every
0.5 seconds to reduce CPU usage:
detectMessageFlooding(), peerInteraction->checkRequestSlot(),
checkHave(), sendKeepAlive().
(checkLongTimePeerChoking): Commented out.
* src/BitfieldMan.h
(getNthBitIndex): Changed the method signature.
(getMissingIndexRandomly): Changed the method signature.
* src/BitfieldMan.cc
(getNthBitIndex): Rewritten
(getMissingIndexRandomly): Rewritten.
(hasMissingPiece): Rewritten.
(getMissingIndex): Refactored.
(getMissingUnusedIndex); Refactored.
(getMissingIndex): Refactored.
Diffstat (limited to 'src/HaveEraseCommand.cc')
| -rw-r--r-- | src/HaveEraseCommand.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/HaveEraseCommand.cc b/src/HaveEraseCommand.cc new file mode 100644 index 00000000..f22f474f --- /dev/null +++ b/src/HaveEraseCommand.cc @@ -0,0 +1,34 @@ +/* <!-- copyright */ +/* + * aria2 - a simple utility for downloading files faster + * + * Copyright (C) 2006 Tatsuhiro Tsujikawa + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +/* copyright --> */ +#include "HaveEraseCommand.h" + +bool HaveEraseCommand::execute() { + if(e->torrentMan->isHalt()) { + return true; + } + if(cp.elapsed(interval)) { + cp.reset(); + e->torrentMan->removeAdvertisedPiece(5); + } + e->commands.push_back(this); + return false; +} |
