r26918 - trunk/freenet/src/freenet/support

[email protected] Thu, 16 Apr 2009 23:44:41 +0000
Newsgroups gmane.network.freenet.cvs
Message-ID <[email protected]>
Author: xor
Date: 2009-04-16 23:44:41 +0000 (Thu, 16 Apr 2009)
New Revision: 26918

Modified:
   trunk/freenet/src/freenet/support/TransferThread.java
Log:
Add two missing methods so we can abort fetches and inserts separately instead of just being able to abort all.

Modified: trunk/freenet/src/freenet/support/TransferThread.java
===================================================================
--- trunk/freenet/src/freenet/support/TransferThread.java	2009-04-16 23:36:16 UTC (rev 26917)
+++ trunk/freenet/src/freenet/support/TransferThread.java	2009-04-16 23:44:41 UTC (rev 26918)
@@ -107,21 +107,27 @@
 	protected void abortAllTransfers() {
 		Logger.debug(this, "Trying to stop all requests & inserts");
 		
-		if(mFetches != null)
-			synchronized(mFetches) {
+		abortFetches();
+		abortInserts();
+	}
+	
+	protected void abortFetches() {
+		Logger.debug(this, "Trying to stop all fetches");
+		if(mFetches != null) synchronized(mFetches) {
 				Iterator<ClientGetter> r = mFetches.iterator();
 				int rcounter = 0;
 				while (r.hasNext()) { r.next().cancel(null, mNode.clientCore.clientContext); r.remove(); ++rcounter; }
 				Logger.debug(this, "Stopped " + rcounter + " current requests");
-			}
-
-		if(mInserts != null)
-			synchronized(mInserts) {
+		}
+	}
+	
+	protected void abortInserts() {
+		if(mInserts != null) synchronized(mInserts) {
 				Iterator<BaseClientPutter> i = mInserts.iterator();
 				int icounter = 0;
 				while (i.hasNext()) { i.next().cancel(null, mNode.clientCore.clientContext); i.remove(); ++icounter; }
 				Logger.debug(this, "Stopped " + icounter + " current inserts");
-			}
+		}
 	}
 	
 	protected void addFetch(ClientGetter g) {