diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2006-04-19 17:23:58 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2006-04-19 17:23:58 +0000 |
| commit | e199bf88986ce441c3383e3c00ce4864a77023b2 (patch) | |
| tree | 7fedb64bd0089a92251ae77aa0ec318aa35d33b6 /src/TrackerWatcherCommand.cc | |
| parent | 195aff51ba58e62a139f1a392208c88cccb3af3d (diff) | |
To add TrackerUpdateCommand with which replaces
CompactTrackerResponseProcessor:
* src/TrackerWatcherCommand.h (req): Removed.
* src/TrackerWatcherCommand.cc (execute): Send a request to
tracker
if the number of peer connections are less than 30.
* src/ByteArrayDiskWriter.h (readData): Implemented.
* src/SegmentMan.h (diskWriter): New function.
* src/SegmentMan.cc (init): Added a call to
diskWriter->closeFile()
* src/main.cc : Removed #include
"CompactTrackerResponseProcessor.h"
(main): Use TrackerUpdateCommand.
* src/TorrentMan.h (CompactTrackerResponseProcessor): Removed.
(req): New variable.
(setTrackerResponseProcessor): Removed.
(getTrackerResponseProcessor): Removed.
(processTrackerResponse): Removed.
* src/DownloadEngine.h (diskWriter): Removed.
* src/TorrentDownloadEngine.cc (afterEachIteration): Removed a
call
to torrentMan->processTrackerResponse().
To add Util::expandBuffer:
* src/ByteArrayDiskWriter.h (expandBuffer): Removed.
* src/ByteArrayDiskWriter.cc (writeData): Use
Util::expandBuffer().
* src/Util.h (expandBuffer): New function.
To fix the bug that causes segmentation fault when "-l ." is
specified
in command-line option:
* src/SimpleLogger.h (SimpleLogger): Removed "filename"
argument.
(openFile): New function.
(closeFile): New function.
* src/SimpleLogger.cc (SimpleLogger): Removed fopen.
(~SimpleLogger): Call closeFile();
* src/LogFactory.cc (getInstance): Added a call to
slogger->openFile().
* src/main.cc (main): Added a check to see logger is configured
properly.
To enable HTTP authentication without specifying
"--http-auth-scheme"
* src/prefs.h (PREF_HTTP_AUTH_ENABLED): New definition.
* src/HttpConnection.cc (createRequest): Send Authorization
header
if PREF_HTTP_AUTH_ENABLED == V_TRUE.
* src/main.cc (main): Preset PREF_HTTP_AUTH_SCHEME to V_TRUE
If "--http-user" is specified, set PREF_HTTP_AUTH_ENABLED to
V_TRUE
* src/Peer.cc (shouldChoke): Updated algorithm.
* src/message.h (EX_AUTH_FAILED): New definition.
(EX_FILE_OPEN): New definition.
* src/HttpResponseCommand.cc (checkResponse): Throw DlAbortEx
if status == 401.
(handleDefaultEncoding): Added a call to
diskWriter->initAndOpenFile()
if req->isTorrent == true.
* src/main.cc (handler): Removed the check to see e->diskWriter
!= NULL
(torrentHandler): Removed the check to see diskAdaptor != NULL.
* src/AbstractDiskWriter.cc (openExistingFile): Updated
messsage.
(createFile): Updated message.
Diffstat (limited to 'src/TrackerWatcherCommand.cc')
| -rw-r--r-- | src/TrackerWatcherCommand.cc | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/TrackerWatcherCommand.cc b/src/TrackerWatcherCommand.cc index 7ff43ee4..aaeb5258 100644 --- a/src/TrackerWatcherCommand.cc +++ b/src/TrackerWatcherCommand.cc @@ -24,30 +24,30 @@ #include "InitiateConnectionCommandFactory.h" #include "Util.h" -TrackerWatcherCommand::TrackerWatcherCommand(int cuid, Request* req, +TrackerWatcherCommand::TrackerWatcherCommand(int cuid, TorrentDownloadEngine* e): - Command(cuid), req(req), e(e) { + Command(cuid), e(e) { } TrackerWatcherCommand::~TrackerWatcherCommand() {} bool TrackerWatcherCommand::execute() { - if(e->torrentMan->trackers == 0) { - req->resetTryCount(); + if(e->torrentMan->trackers == 0 && e->torrentMan->connections < 30) { + e->torrentMan->req->resetTryCount(); if(e->torrentMan->downloadComplete()) { - if(req->getTrackerEvent() == Request::COMPLETED) { - req->setTrackerEvent(Request::AFTER_COMPLETED); + if(e->torrentMan->req->getTrackerEvent() == Request::COMPLETED) { + e->torrentMan->req->setTrackerEvent(Request::AFTER_COMPLETED); } else { - if(req->getTrackerEvent() == Request::STARTED) { - req->setTrackerEvent(Request::AFTER_COMPLETED); - } else if(req->getTrackerEvent() != Request::AFTER_COMPLETED) { - req->setTrackerEvent(Request::COMPLETED); + if(e->torrentMan->req->getTrackerEvent() == Request::STARTED) { + e->torrentMan->req->setTrackerEvent(Request::AFTER_COMPLETED); + } else if(e->torrentMan->req->getTrackerEvent() != Request::AFTER_COMPLETED) { + e->torrentMan->req->setTrackerEvent(Request::COMPLETED); } } } string event; - switch(req->getTrackerEvent()) { + switch(e->torrentMan->req->getTrackerEvent()) { case Request::STARTED: event = "started"; break; @@ -74,8 +74,8 @@ bool TrackerWatcherCommand::execute() { if(!e->torrentMan->trackerId.empty()) { url += string("&")+"trackerid="+e->torrentMan->trackerId; } - req->setUrl(url); - Command* command = InitiateConnectionCommandFactory::createInitiateConnectionCommand(e->torrentMan->getNewCuid(), req, e); + e->torrentMan->req->setUrl(url); + Command* command = InitiateConnectionCommandFactory::createInitiateConnectionCommand(e->torrentMan->getNewCuid(), e->torrentMan->req, e); e->commands.push(command); e->torrentMan->trackers++; logger->info("CUID#%d - creating new tracker request command #%d", cuid, |
