r26848 - trunk/freenet/src/freenet/node/fcp

[email protected] Wed, 15 Apr 2009 17:04:39 +0000
Newsgroups gmane.network.freenet.cvs
Message-ID <[email protected]>
Author: toad
Date: 2009-04-15 17:04:38 +0000 (Wed, 15 Apr 2009)
New Revision: 26848

Modified:
   trunk/freenet/src/freenet/node/fcp/SubscribeUSK.java
   trunk/freenet/src/freenet/node/fcp/SubscribeUSKMessage.java
Log:
Allow specifying PriorityClass and PriorityClassProgress in SubscribeUSK. Needs to be documented on the wiki.


Modified: trunk/freenet/src/freenet/node/fcp/SubscribeUSK.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/SubscribeUSK.java	2009-04-15 16:49:08 UTC (rev 26847)
+++ trunk/freenet/src/freenet/node/fcp/SubscribeUSK.java	2009-04-15 17:04:38 UTC (rev 26848)
@@ -18,12 +18,16 @@
 	final String identifier;
 	final NodeClientCore core;
 	final boolean dontPoll;
+	final short prio;
+	final short prioProgress;
 	
 	public SubscribeUSK(SubscribeUSKMessage message, NodeClientCore core, FCPConnectionHandler handler) {
 		this.handler = handler;
 		this.dontPoll = message.dontPoll;
 		this.identifier = message.identifier;
 		this.core = core;
+		prio = message.prio;
+		prioProgress = message.prioProgress;
 		core.uskManager.subscribe(message.key, this, !message.dontPoll, handler.getRebootClient().lowLevelClient);
 	}
 
@@ -37,11 +41,11 @@
 	}
 
 	public short getPollingPriorityNormal() {
-		return RequestStarter.BULK_SPLITFILE_PRIORITY_CLASS;
+		return prio;
 	}
 
 	public short getPollingPriorityProgress() {
-		return RequestStarter.UPDATE_PRIORITY_CLASS;
+		return prioProgress;
 	}
 
 }

Modified: trunk/freenet/src/freenet/node/fcp/SubscribeUSKMessage.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/SubscribeUSKMessage.java	2009-04-15 16:49:08 UTC (rev 26847)
+++ trunk/freenet/src/freenet/node/fcp/SubscribeUSKMessage.java	2009-04-15 17:04:38 UTC (rev 26848)
@@ -10,6 +10,7 @@
 import freenet.keys.FreenetURI;
 import freenet.keys.USK;
 import freenet.node.Node;
+import freenet.node.RequestStarter;
 import freenet.support.Fields;
 import freenet.support.SimpleFieldSet;
 
@@ -31,6 +32,8 @@
 	final USK key;
 	final boolean dontPoll;
 	final String identifier;
+	final short prio;
+	final short prioProgress;
 	
 	public SubscribeUSKMessage(SimpleFieldSet fs) throws MessageInvalidException {
 		this.identifier = fs.get("Identifier");
@@ -47,6 +50,8 @@
 			throw new MessageInvalidException(ProtocolErrorMessage.INVALID_FIELD, "Could not parse URI: "+e, identifier, false);
 		}
 		this.dontPoll = Fields.stringToBool(fs.get("DontPoll"), false);
+		prio = fs.getShort("PriorityClass", RequestStarter.BULK_SPLITFILE_PRIORITY_CLASS);
+		prioProgress = fs.getShort("PriorityClassProgress", (short)Math.max(0, prio-1));
 	}
 
 	@Override