Author: toad
Date: 2009-03-26 20:47:03 +0000 (Thu, 26 Mar 2009)
New Revision: 26220
Modified:
branches/db4o/freenet/src/freenet/client/async/SplitFileInserter.java
branches/db4o/freenet/src/freenet/client/async/SplitFileInserterSegment.java
Log:
Copy the URIs. Marginal performance cost but it saves us having to worry about
stuff needing to be deleted in onMetadata(), which is non-obvious - the
reasonable expectation is that it's in RAM.
Modified: branches/db4o/freenet/src/freenet/client/async/SplitFileInserter.java
===================================================================
--- branches/db4o/freenet/src/freenet/client/async/SplitFileInserter.java
2009-03-26 19:28:01 UTC (rev 26219)
+++ branches/db4o/freenet/src/freenet/client/async/SplitFileInserter.java
2009-03-26 20:47:03 UTC (rev 26220)
@@ -383,14 +383,10 @@
container.activate(segments[i], 1);
ClientCHK[] data = segments[i].getDataCHKs();
System.arraycopy(data, 0, dataURIs, dpos,
data.length);
- if(persistent) segments[i].clearDataCHKs();
dpos += data.length;
ClientCHK[] check = segments[i].getCheckCHKs();
System.arraycopy(check, 0, checkURIs, cpos,
check.length);
- if(persistent) segments[i].clearCheckCHKs();
cpos += check.length;
- if(persistent)
- container.store(segments[i]);
if(persistent && segments[i] !=
dontDeactivateSegment)
container.deactivate(segments[i], 1);
}
@@ -401,10 +397,17 @@
missingURIs = anyNulls(dataURIs) || anyNulls(checkURIs);
if(persistent) {
- for(ClientCHK key : dataURIs)
- container.activate(key, 5);
- for(ClientCHK key : checkURIs)
- container.activate(key, 5);
+ // Copy the URIs. We don't know what the callee
wants the metadata for:
+ // he might well ignore it, as in
SimpleManifestPutter.onMetadata().
+ // This way he doesn't need to worry about
removing them.
+ for(int i=0;i<dataURIs.length;i++) {
+ container.activate(dataURIs[i], 5);
+ dataURIs[i] = dataURIs[i].cloneKey();
+ }
+ for(int i=0;i<checkURIs.length;i++) {
+ container.activate(checkURIs[i], 5);
+ checkURIs[i] = checkURIs[i].cloneKey();
+ }
}
if(!missingURIs) {
Modified:
branches/db4o/freenet/src/freenet/client/async/SplitFileInserterSegment.java
===================================================================
---
branches/db4o/freenet/src/freenet/client/async/SplitFileInserterSegment.java
2009-03-26 19:28:01 UTC (rev 26219)
+++
branches/db4o/freenet/src/freenet/client/async/SplitFileInserterSegment.java
2009-03-26 20:47:03 UTC (rev 26220)
@@ -786,16 +786,6 @@
return dataURIs;
}
- public void clearCheckCHKs() {
- for(int i=0;i<checkURIs.length;i++)
- checkURIs[i] = null;
- }
-
- public void clearDataCHKs() {
- for(int i=0;i<dataURIs.length;i++)
- dataURIs[i] = null;
- }
-
/** Get the InsertException for this segment.
* NOTE: This will be deleted when the segment is deleted! Do not store
it or pass
* it on!
_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs