Author: toad
Date: 2009-04-15 22:39:47 +0000 (Wed, 15 Apr 2009)
New Revision: 26862
Modified:
trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
Log:
dontSchedule is always true
Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
2009-04-15 22:36:46 UTC (rev 26861)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSegment.java
2009-04-15 22:39:47 UTC (rev 26862)
@@ -960,7 +960,7 @@
Logger.minor(this, "Added to cooldown queue:
"+key+" for "+this+" was on segment "+seg+" now registered to "+sub);
} else {
// If we are here we are going to retry
- mustSchedule = sub.add(blockNo, true, container,
context, false);
+ mustSchedule = sub.add(blockNo, container, context,
false);
if(logMINOR)
Logger.minor(this, "Retrying block "+blockNo+"
on "+this+" : tries="+tries+"/"+maxTries+" : "+sub);
}
@@ -1069,7 +1069,7 @@
SplitFileFetcherSubSegment seg = getSubSegment(0,
container, false, null);
if(persistent)
container.activate(seg, 1);
- seg.addAll(dataRetries.length+checkRetries.length,
true, container, context, false);
+ seg.addAll(dataRetries.length+checkRetries.length,
container, context, false);
if(logMINOR)
Logger.minor(this, "scheduling "+seg+" :
"+seg.blockNums);
@@ -1218,7 +1218,7 @@
Logger.minor(this, "Retrying after
cooldown on "+this+": data block "+i+" on "+this+" :
tries="+tries+"/"+maxTries+" : "+sub);
if(v == null) v = new
Vector<SplitFileFetcherSubSegment>();
// We always schedule. FIXME: only schedule if
sub.add() returns true???
- sub.add(i, true, container, context, true);
+ sub.add(i, container, context, true);
if(!v.contains(sub)) v.add(sub);
notFound = false;
} else {
@@ -1242,7 +1242,7 @@
if(logMINOR)
Logger.minor(this, "Retrying after
cooldown on "+this+": check block "+i+" on "+this+" :
tries="+tries+"/"+maxTries+" : "+sub);
if(v == null) v = new
Vector<SplitFileFetcherSubSegment>();
- sub.add(i+dataKeys.length, true, container,
context, true);
+ sub.add(i+dataKeys.length, container, context,
true);
if(!v.contains(sub)) v.add(sub);
notFound = false;
} else {
Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
2009-04-15 22:36:46 UTC (rev 26861)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
2009-04-15 22:39:47 UTC (rev 26862)
@@ -487,20 +487,19 @@
return false;
}
- public void addAll(int blocks, boolean dontSchedule, ObjectContainer
container, ClientContext context, boolean dontComplainOnDupes) {
+ public void addAll(int blocks, ObjectContainer container, ClientContext
context, boolean dontComplainOnDupes) {
int[] list = new int[blocks];
for(int i=0;i<blocks;i++) list[i] = i;
- addAll(list, dontSchedule, container, context,
dontComplainOnDupes);
+ addAll(list, container, context, dontComplainOnDupes);
}
- public void addAll(int[] blocks, boolean dontSchedule, ObjectContainer
container, ClientContext context, boolean dontComplainOnDupes) {
+ public void addAll(int[] blocks, ObjectContainer container,
ClientContext context, boolean dontComplainOnDupes) {
if(persistent) {
// container.activate(segment, 1);
container.activate(blockNums, 1);
}
boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
- if(logMINOR) Logger.minor(this, "Adding "+blocks+" blocks to
"+this+" dontSchedule="+dontSchedule);
- boolean schedule = true;
+ if(logMINOR) Logger.minor(this, "Adding "+blocks+" blocks to
"+this);
synchronized(segment) {
if(cancelled)
throw new IllegalStateException("Adding blocks
to already cancelled "+this);
@@ -515,50 +514,22 @@
} else {
blockNums.add(ii);
}
- if(dontSchedule) schedule = false;
- /**
- * Race condition:
- *
- * Starter thread sees there is only one block
on us, so removes us.
- * Another thread adds a block. We don't
schedule as we now have two blocks.
- * Starter thread removes us.
- * Other blocks may be added later, but we are
never rescheduled.
- *
- * Fixing this by only removing the
SendableRequest after we've removed the
- * block is nontrivial with the current code.
- * So what we do here is simply check whether
we are registered, instead of
- * checking whether blockNums.size() > 1 as we
used to.
- */
- if(schedule && getParentGrabArray() != null) {
- if(logMINOR) Logger.minor(this,
"Already registered, not scheduling: "+blockNums.size()+" : "+blockNums);
- schedule = false;
- }
-
}
}
if(persistent)
container.store(blockNums);
- if(schedule) {
- // Only need to register once for all the blocks.
- try {
- context.getChkFetchScheduler().register(null,
new SendableGet[] { this }, persistent, true, container, null, true);
- } catch (KeyListenerConstructionException e) {
- Logger.error(this, "Impossible: "+e+" on
"+this, e);
- }
- }
-
}
/**
* @return True if the caller should schedule.
*/
- public boolean add(int blockNo, boolean dontSchedule, ObjectContainer
container, ClientContext context, boolean dontComplainOnDupes) {
+ public boolean add(int blockNo, ObjectContainer container,
ClientContext context, boolean dontComplainOnDupes) {
if(persistent) {
// container.activate(segment, 1);
container.activate(blockNums, 1);
}
boolean logMINOR = Logger.shouldLog(Logger.MINOR, this);
- if(logMINOR) Logger.minor(this, "Adding block "+blockNo+" to
"+this+" dontSchedule="+dontSchedule);
+ if(logMINOR) Logger.minor(this, "Adding block "+blockNo+" to
"+this);
if(blockNo < 0) throw new IllegalArgumentException();
Integer i = Integer.valueOf(blockNo);
@@ -594,15 +565,7 @@
}
if(persistent)
container.store(blockNums);
- if(schedule) {
- if(dontSchedule) return true;
- try {
- context.getChkFetchScheduler().register(null,
new SendableGet[] { this }, persistent, true, container, null, true);
- } catch (KeyListenerConstructionException e) {
- Logger.error(this, "Impossible: "+e+" on
"+this, e);
- }
- }
- return false;
+ return schedule;
}
@Override
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs