summaryrefslogtreecommitdiff
path: root/src/PeerAbstractCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2006-09-21 13:49:06 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2006-09-21 13:49:06 +0000
commit8b8325cafcfecc8c32a4f49a48ee7cfcc68d450a (patch)
treeed9621c75ee6d0c95f6dcc3064adc14322e179a9 /src/PeerAbstractCommand.cc
parent65e0ffe6caa5f3ad9b4ccf49045f9e7ed144ee07 (diff)
* src/PeerChokeCommand.cc
(optUnchokingPeer): Updated according to the changes in Peer. (ResetDelta): Removed. (UploadFaster): Updated according to the changes in Peer. (DownloadFaster): Updated according to the changes in Peer. (execute): I clarify the meaning of "upload" and "download" here. "upload" means the transfer from localhost to remote host. "download" means the transfer from remote host to localhost. Based on this rule, I swapped orderByUploadRate and orderByDownloadRate. * src/PeerInteractionCommand.cc (PeerInteraction): Removed peerInteraction->setUploadLImit(). (executeInternal): Removed the argument of peerInteraction->sendMessages(). (receiveMessages): Rewritten download speed limit. (sendKeepAlive): Removed peerInteraction->sendMessages(). * src/HttpResponseCommand.cc (handleDefaultEncoding): If file size is unknown in torrent request, do not call segmentMan->initBitfield() here. Disabled persistent connection feature in torrent request. * src/UrlRequestInfo.h (UrlRequestInfo): Removed const qualifier from option. * src/TorrentMan.h (TransferStat): New class. (deltaDownloadLength): Removed. (deltaUploadLength): Removed. (addDeltaDownloadLength): Removed. (getDeltaDownloadLength): Removed. (resetDeltaDownloadLength): Removed. (addDeltaUploadLength): Removed. (getDeltaUploadLength): Removed. (resetDeltaUploadLength): Removed. (addActivePeer): Added peer->activate(). (deleteActivePeer): Added peer->deactivate(). (calculateStat): New function. * src/TorrentMan.cc (TorrentMan): Removed deltaDownloadLength and deltaUploadLength. (calculateStat): New function. * src/PeerInteraction.h (uploadLimit): Removed. (option): New variable. (setUploadLimit): Removed. (getUploadSpeed): Removed. (sendMessages): Removed the argument "currentUploadSpeed". * src/PeerInteraction.cc (prefs.h): Included. (PeerInteraction): Removed uploadLimit. Added option. (sendMessages): Rewritten upload speed limit. (sendHandshake): Removed the argument from sendMessages(). (sendBitfield): Removed the argument from sendMessages(). * src/PeerAbstractCommand.cc (execute): Commented out the portion of upload limit. (onAbort): Removed peer->resetStatus(). * src/TorrentRequestInfo.cc (timeoutSpecified): Declared extern. (execute): Set timeout to 180 if timeout is not specified by. command-line. * src/PieceMessage.cc (receivedAction): Added peer->updateDownloadLength(). Removed peer->addPeerUpload(). Removed torrentMan->addDeltaDownloadLength(). (send): Added peer->updateUploadLength(). Removed peer->addPeerDownload(). Removed torrentMan->addDeltaUploadLength(). * src/main.cc (timeoutSpecified): New variable. (main): Set timeoutSpecified to false. If the command-line option "--upload-limit" is specified, then timeoutSpecified is set to true. This option will remain in the next release, but be deprecated in the future release. * src/TorrentRequestInfo.h (TorrentRequestInfo): Removed const qualifier from op. * src/PeerStat.h (uploadSpeed): New variable. (PeerStat): Added default value to cuid. (calculateUploadSpeed): New function. (updateUploadLength): New function. (getMaxUploadSpeed): New function. (getAvgUploadSpeed): New function. (reset): Added uploadSpeed. Set status to IDLE. * src/TorrentDownloadEngine.h (cp): Declared as Time. (sessionDownloadLengthArray): Removed. (sessionUploadLengthArray): Removed. (currentCp): Removed. (lastCalcStat): New variable (lastElapsed): Removed. (sessionDownloadLength): Removed. (calculateStat): New function. * src/TorrentDownloadEngine.cc (initStatistics): Removed lastElapsed, cp[], sessionDownloadLengthArray[], sessionUploadLengthArray[], currentCp, sessionDownloadLength. Added cp.reset() and lastCalcStat.reset(). (calculateSpeed): Changed the name of the argument. (calculateStatistics): Rewritten. (calculateStat): New function. * src/Peer.h (PeerStat.h): Included. (peerUpload): Removed. (peerDownload): Removed. (peerStat): New variable. (sessionUploadLength): New variable. (sessionDownloadLength): New variable. (deltaUpload): Removed. (deltaDownload): Removed. (resetStatus): Made private. (Peer): Added sessionUploadLength, sessionDownloadLength. Removed peerUpload, peerDownload. (updateUploadLength): New function. (addDeltaUpload): Removed. (updateDownloadLength): New function. (resetDeltaUpload): Removed. (getDeltaUpload): Removed. (addDeltaDownload): Removed. (calculateUploadSpeed): New function. (resetDeltaDownload): Removed. (getDeltaDownload): Removed. (calculateDownloadSpeed): New function. (getSessionUploadLength): New function. (getSessionDownloadLength): New function. (activate): New function. (deactivate): New function. (addPeerUpload): Removed. (setPeerUpload): Removed. (getPeerUpload): Removed. (addPeerDownload): Removed. (setPeerDownload): Removed. (getPeerDownload): Removed. * src/Peer.cc (resetStatus): Removed resetDeltaUpload() and resetDeltaDownload(). * src/MetalinkRequestInfo.h (MetalinkRequestInfo): Removed const qualifier from op. * src/RequestInfo.h (op): Removed const qualifier. (RequestInfo): Removed const qualifier from op.
Diffstat (limited to 'src/PeerAbstractCommand.cc')
-rw-r--r--src/PeerAbstractCommand.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/PeerAbstractCommand.cc b/src/PeerAbstractCommand.cc
index fe663b7e..3a8faa18 100644
--- a/src/PeerAbstractCommand.cc
+++ b/src/PeerAbstractCommand.cc
@@ -49,8 +49,10 @@ bool PeerAbstractCommand::execute() {
}
try {
if(noCheck ||
+ /*
uploadLimitCheck && (uploadLimit == 0 ||
e->getUploadSpeed() <= uploadLimit*1024) ||
+ */
checkSocketIsReadable && readCheckTarget->isReadable(0) ||
checkSocketIsWritable && writeCheckTarget->isWritable(0)) {
checkPoint.reset();
@@ -61,8 +63,10 @@ bool PeerAbstractCommand::execute() {
return executeInternal();
} catch(Exception* err) {
logger->error(MSG_DOWNLOAD_ABORTED, err, cuid);
+ logger->debug("CUID#%d - Peer %s:%d banned.",
+ cuid, peer->ipaddr.c_str(), peer->port);
onAbort(err);
- delete(err);
+ delete err;
return prepareForNextPeer(0);
}
}
@@ -82,8 +86,6 @@ void PeerAbstractCommand::onAbort(Exception* ex) {
} else {
peer->error += MAX_PEER_ERROR;
}
- peer->resetStatus();
- logger->debug("CUID#%d - Peer %s:%d banned.", cuid, peer->ipaddr.c_str(), peer->port);
}
void PeerAbstractCommand::disableReadCheckSocket() {