Author: toad
Date: 2006-01-25 16:50:35 +0000 (Wed, 25 Jan 2006)
New Revision: 7921
Modified:
branches/async-client/src/freenet/client/async/ClientGetter.java
branches/async-client/src/freenet/node/fcp/ClientGet.java
branches/async-client/src/freenet/node/fcp/ClientPut.java
Log:
FCP works, at least for get/put small CHKs.
Modified: branches/async-client/src/freenet/client/async/ClientGetter.java
===================================================================
--- branches/async-client/src/freenet/client/async/ClientGetter.java
2006-01-25 16:44:41 UTC (rev 7920)
+++ branches/async-client/src/freenet/client/async/ClientGetter.java
2006-01-25 16:50:35 UTC (rev 7921)
@@ -34,14 +34,12 @@
archiveRestarts = 0;
}
- public void start() {
+ public void start() throws FetchException {
try {
currentState = new SingleFileFetcher(this, this, new
ClientMetadata(), uri, ctx, actx, getPriorityClass(), 0, false, null);
currentState.schedule();
} catch (MalformedURLException e) {
- onFailure(new
FetchException(FetchException.INVALID_URI, e), null);
- } catch (FetchException e) {
- onFailure(e, null);
+ throw new FetchException(FetchException.INVALID_URI, e);
}
}
@@ -52,17 +50,25 @@
}
public void onFailure(FetchException e, ClientGetState state) {
- if(e.mode == FetchException.ARCHIVE_RESTART) {
- archiveRestarts++;
- if(archiveRestarts > ctx.maxArchiveRestarts)
- e = new
FetchException(FetchException.TOO_MANY_ARCHIVE_RESTARTS);
- else {
- start();
- return;
+ while(true) {
+ if(e.mode == FetchException.ARCHIVE_RESTART) {
+ archiveRestarts++;
+ if(archiveRestarts > ctx.maxArchiveRestarts)
+ e = new
FetchException(FetchException.TOO_MANY_ARCHIVE_RESTARTS);
+ else {
+ try {
+ start();
+ } catch (FetchException e1) {
+ e = e1;
+ continue;
+ }
+ return;
+ }
}
+ finished = true;
+ client.onFailure(e, this);
+ return;
}
- finished = true;
- client.onFailure(e, this);
}
public void cancel() {
Modified: branches/async-client/src/freenet/node/fcp/ClientGet.java
===================================================================
--- branches/async-client/src/freenet/node/fcp/ClientGet.java 2006-01-25
16:44:41 UTC (rev 7920)
+++ branches/async-client/src/freenet/node/fcp/ClientGet.java 2006-01-25
16:50:35 UTC (rev 7921)
@@ -46,6 +46,11 @@
fctx.maxOutputLength = message.maxSize;
fctx.maxTempLength = message.maxTempSize;
getter = new ClientGetter(this, handler.node.fetchScheduler,
uri, fctx, priorityClass);
+ try {
+ getter.start();
+ } catch (FetchException e) {
+ onFailure(e, null);
+ }
}
public void cancel() {
Modified: branches/async-client/src/freenet/node/fcp/ClientPut.java
===================================================================
--- branches/async-client/src/freenet/node/fcp/ClientPut.java 2006-01-25
16:44:41 UTC (rev 7920)
+++ branches/async-client/src/freenet/node/fcp/ClientPut.java 2006-01-25
16:50:35 UTC (rev 7921)
@@ -34,6 +34,11 @@
String mimeType = message.contentType;
block = new InsertBlock(message.bucket, new
ClientMetadata(mimeType), uri);
inserter = new ClientPutter(this, message.bucket, uri, new
ClientMetadata(mimeType), ctx, handler.node.putScheduler, priorityClass,
getCHKOnly, false);
+ try {
+ inserter.start();
+ } catch (InserterException e) {
+ onFailure(e, null);
+ }
}
public void cancel() {