diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2006-04-28 15:55:11 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2006-04-28 15:55:11 +0000 |
| commit | df2364b1db6c347e14748e3f43720acd4a327baf (patch) | |
| tree | fabde5d8346890367e0bd160dac802b68beeca85 /src/PeerChokeCommand.h | |
| parent | af2a03fbf172dd6960934c539006e9dc72a22052 (diff) | |
2006-04-29 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To add --select-file command-line option:
* src/Util.cc
(unfoldRange): New function.
(getNum): New function.
(unfoldSubRange): New function
* src/main.cc
(showUsage): Added help message.
(main): Added --select-file command-line option.
2006-04-28 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
To deploy upload rate based choking algorithm:
* src/PeerInteractionCommand.cc
(PeerInteractionCommand): Add peer to TorrentMan::activePeers to
track
peer currently used.
(decideChoking): Deleted the choke/unchoke decision algorithm
when
download completes. Simplified.
(receiveMessage): Updated.
* src/TorrentMan.h
(activePeers): New variable.
(addActivePeer): New function.
(getActivePeers): New function.
(deleteActivePeer): New function.
* src/TorrentMan.cc
(addPeer): deleteOldErrorPeers is moved to the begining of the
function
* src/PeerAbstractCommand.cc
(onAbort): Use peer->resetStatus().
* src/main.cc
(PeerChokeCommand.h): Included.
(main): Added the instance of ChokingCommand to the command
queue.
* src/Peer.h
(amChoking): Renamed from amChocking
(chokingRequired): New variable.
(optUnchoking): New variable.
(deltaUpload): New variable.
(deltaDownload): New variable.
(addDeltaUpload): New function.
(resetDeltaUpload): New function.
(addDeltaDownload): New function.
(resetDeltaDownload): New function.
(addPeerUpload): Added a call to addDeltaUpload.
(addPeerDownload): Added a call to addDeltaDownload.
* src/Peer.cc
(shouldBeChoking): Renamed from shouldChoke.
(resetStatus): New function.
* src/PeerChokeCommand.h: New class.
* src/PeerChokeCommand.cc: New class.
To add lazy upload speed limiter:
* src/TorrentConsoleDownloadEngine.h: Moved the variables for
statistics calculation to TorrentDownloadEngine.
* src/TorrentConsoleDownloadEngine.cc
(sendStatistics): Renamed from printStatistics.
(initStatistics): Removed. Moved to TorrentDownloadEngine.
(calculateSpeed): Removed. Moved to TorrentDownloadEngine.
(calculateStatistics): Removed. Moved to TorrentDownloadEngine.
* src/TorrentDownloadEngine.h: Added the variables for
statistics
calculation.
(sendStatistics): New function as pure virtual function.
(getUploadSpeed): New function.
* src/TorrentDownloadEngine.cc
(initStatistics): New function.
(calculateSpeed): New function.
(calculateStatistics): New function.
* src/SendMessageQueue.h
(uploadLength): New variable.
(send): Added an argument.
(setUploadLimit): New function.
(getUploadLimit): New function.
* src/SendMessageQueue.cc
(send): Added upload speed limiter.
* src/prefs.h
(PREF_UPLOAD_LIMIT): New definition.
* src/PeerInteractionCommand.cc
(PeerInteractionCommand): Set upload speed limit to
sendMessageQueue.
* src/main.cc
(main): Added --upload-limit option
For bug fixes:
* src/main.cc
(showUsage): Corrected --listen-port help
Other changes:
* src/TorrentMan.cc
(getPeer): Return nullPeer if connection is grather than
MAX_PEER_UPDATE(15) in order to leave space for incoming peers.
Diffstat (limited to 'src/PeerChokeCommand.h')
| -rw-r--r-- | src/PeerChokeCommand.h | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/src/PeerChokeCommand.h b/src/PeerChokeCommand.h new file mode 100644 index 00000000..855cb1cf --- /dev/null +++ b/src/PeerChokeCommand.h @@ -0,0 +1,48 @@ +/* <!-- 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 --> */ +#ifndef _D_PEER_CHOKE_COMMAND_H_ +#define _D_PEER_CHOKE_COMMAND_H_ + +#include "Command.h" +#include "TorrentDownloadEngine.h" + +class PeerChokeCommand : public Command { +private: + int interval; + TorrentDownloadEngine* e; + int rotate; + + void orderByUploadRate(Peers& peers) const; + void orderByDownloadRate(Peers& peers) const; + void setAllPeerChoked(Peers& peers) const; + void setAllPeerResetDeltaUpload(Peers& peers) const; + void setAllPeerResetDeltaDownload(Peers& peers) const; + void optUnchokingPeer(Peers& peers) const; + +public: + PeerChokeCommand(int cuid, int interval, TorrentDownloadEngine* e); + virtual ~PeerChokeCommand(); + + bool execute(); +}; + +#endif // _D_PEER_CHOKE_COMMAND_H_ |
