summaryrefslogtreecommitdiff
path: root/src/AbstractCommand.cc
diff options
context:
space:
mode:
authorTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-07-11 14:28:18 +0000
committerTatsuhiro Tsujikawa <tatsuhiro.t@gmail.com>2010-07-11 14:28:18 +0000
commitbd73c20c4dfbe5746ef68b12633592c1a681fdf3 (patch)
treee0874fe9761a9f88b467d8e9784a091b2abe2b3c /src/AbstractCommand.cc
parentf3b097b5af5f720192566cd46f626bbd86c429b9 (diff)
2010-07-11 Tatsuhiro Tsujikawa <t-tujikawa@users.sourceforge.net>
Moved segment empty check before socket check. * src/AbstractCommand.cc
Diffstat (limited to 'src/AbstractCommand.cc')
-rw-r--r--src/AbstractCommand.cc42
1 files changed, 21 insertions, 21 deletions
diff --git a/src/AbstractCommand.cc b/src/AbstractCommand.cc
index e48b7954..fde9c7e5 100644
--- a/src/AbstractCommand.cc
+++ b/src/AbstractCommand.cc
@@ -125,6 +125,27 @@ bool AbstractCommand::execute() {
}
return prepareForRetry(0);
}
+ if(!getPieceStorage().isNull()) {
+ segments_.clear();
+ getSegmentMan()->getInFlightSegment(segments_, getCuid());
+ if(!req_.isNull() && segments_.empty()) {
+ // This command previously has assigned segments, but it is
+ // canceled. So discard current request chain. Plus, if no
+ // segment is available when http pipelining is used.
+ if(getLogger()->debug()) {
+ getLogger()->debug("CUID#%s - It seems previously assigned segments"
+ " are canceled. Restart.",
+ util::itos(getCuid()).c_str());
+ }
+ // Request::isPipeliningEnabled() == true means aria2
+ // accessed the remote server and discovered that the server
+ // supports pipelining.
+ if(!req_.isNull() && req_->isPipeliningEnabled()) {
+ e_->poolSocket(req_, createProxyRequest(), socket_);
+ }
+ return prepareForRetry(0);
+ }
+ }
// TODO it is not needed to check other PeerStats every time.
// Find faster Request when no segment is available.
if(!req_.isNull() && fileEntry_->countPooledRequest() > 0 &&
@@ -157,27 +178,6 @@ bool AbstractCommand::execute() {
!nameResolverCheck_)) {
checkPoint_ = global::wallclock;
if(!getPieceStorage().isNull()) {
- segments_.clear();
- getSegmentMan()->getInFlightSegment(segments_, getCuid());
- if(!req_.isNull() && segments_.empty()) {
- // TODO make this out side of socket check if.
-
- // This command previously has assigned segments, but it is
- // canceled. So discard current request chain. Plus, if no
- // segment is available when http pipelining is used.
- if(getLogger()->debug()) {
- getLogger()->debug("CUID#%s - It seems previously assigned segments"
- " are canceled. Restart.",
- util::itos(getCuid()).c_str());
- }
- // Request::isPipeliningEnabled() == true means aria2
- // accessed the remote server and discovered that the server
- // supports pipelining.
- if(!req_.isNull() && req_->isPipeliningEnabled()) {
- e_->poolSocket(req_, createProxyRequest(), socket_);
- }
- return prepareForRetry(0);
- }
if(req_.isNull() || req_->getMaxPipelinedRequest() == 1 ||
// Why the following condition is necessary? That's because
// For single file download, SegmentMan::getSegment(cuid)