Author: toad
Date: 2009-01-24 18:49:01 +0000 (Sat, 24 Jan 2009)
New Revision: 25287
Modified:
branches/db4o/freenet/src/freenet/client/FECJob.java
branches/db4o/freenet/src/freenet/client/FECQueue.java
Log:
Deal with FEC jobs where the originator has been deleted.
Modified: branches/db4o/freenet/src/freenet/client/FECJob.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/FECJob.java 2009-01-24
18:27:06 UTC (rev 25286)
+++ branches/db4o/freenet/src/freenet/client/FECJob.java 2009-01-24
18:49:01 UTC (rev 25287)
@@ -156,4 +156,49 @@
}
}
}
+
+ public boolean isCancelled(ObjectContainer container) {
+ if(callback == null) {
+ for(Bucket data : dataBlocks) {
+ if(data != null) {
+ Logger.error(this, "Callback is null
(deleted??) but data is valid: "+data);
+ data.free();
+ data.removeFrom(container);
+ }
+ }
+ for(Bucket data : checkBlocks) {
+ if(data != null) {
+ Logger.error(this, "Callback is null
(deleted??) but data is valid: "+data);
+ data.free();
+ data.removeFrom(container);
+ }
+ }
+ for(SplitfileBlock block : dataBlockStatus) {
+ if(block != null) {
+ Logger.error(this, "Callback is null
(deleted??) but data is valid: "+block);
+ Bucket data = block.getData();
+ if(data != null) {
+ Logger.error(this, "Callback is
null (deleted??) but data is valid: "+data);
+ data.free();
+ data.removeFrom(container);
+ }
+ container.delete(block);
+ }
+ }
+ for(SplitfileBlock block : checkBlockStatus) {
+ if(block != null) {
+ Logger.error(this, "Callback is null
(deleted??) but data is valid: "+block);
+ Bucket data = block.getData();
+ if(data != null) {
+ Logger.error(this, "Callback is
null (deleted??) but data is valid: "+data);
+ data.free();
+ data.removeFrom(container);
+ }
+ container.delete(block);
+ }
+ }
+ return true;
+ }
+ return false;
+ }
}
\ No newline at end of file
Modified: branches/db4o/freenet/src/freenet/client/FECQueue.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/FECQueue.java 2009-01-24
18:27:06 UTC (rev 25286)
+++ branches/db4o/freenet/src/freenet/client/FECQueue.java 2009-01-24
18:49:01 UTC (rev 25287)
@@ -281,6 +281,10 @@
for(int j=0;j<grab &&
results.hasNext();j++) {
FECJob job = (FECJob)
results.next();
job.activateForExecution(container);
+ if(job.isCancelled()) {
+
container.delete(job);
+ continue;
+ }
if(logMINOR)
Logger.minor(this, "Maybe adding "+job);
synchronized(FECQueue.this) {
if(job.running)
{
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs