r26947 - in branches/nextgens-stuffs/freenet/src/freenet: io/comm node

[email protected] Fri, 17 Apr 2009 17:35:25 +0000
Newsgroups gmane.network.freenet.cvs
Message-ID <[email protected]>
Author: nextgens
Date: 2009-04-17 17:35:24 +0000 (Fri, 17 Apr 2009)
New Revision: 26947

Modified:
   branches/nextgens-stuffs/freenet/src/freenet/io/comm/PeerContext.java
   branches/nextgens-stuffs/freenet/src/freenet/node/PeerNode.java
Log:
Doh, fix ClassCastException

Modified: branches/nextgens-stuffs/freenet/src/freenet/io/comm/PeerContext.java
===================================================================
--- branches/nextgens-stuffs/freenet/src/freenet/io/comm/PeerContext.java	2009-04-17 17:12:49 UTC (rev 26946)
+++ branches/nextgens-stuffs/freenet/src/freenet/io/comm/PeerContext.java	2009-04-17 17:35:24 UTC (rev 26947)
@@ -16,7 +16,7 @@
  * Everything that is needed to send a message, including the Peer.
  * Implemented by PeerNode, for example.
  */
-public interface PeerContext {
+public interface PeerContext extends Comparable<PeerContext>{
     // Largely opaque interface for now
     Peer getPeer();
 
@@ -62,4 +62,6 @@
 	
 	/** Report a transfer failure */
 	void transferFailed(String reason);
+	
+    public abstract int compareTo(PeerContext o);
 }

Modified: branches/nextgens-stuffs/freenet/src/freenet/node/PeerNode.java
===================================================================
--- branches/nextgens-stuffs/freenet/src/freenet/node/PeerNode.java	2009-04-17 17:12:49 UTC (rev 26946)
+++ branches/nextgens-stuffs/freenet/src/freenet/node/PeerNode.java	2009-04-17 17:35:24 UTC (rev 26947)
@@ -976,7 +976,10 @@
 	public int getIdentityHash() {
 		return hashCode;
 	}
-
+	
+	public int compareTo(PeerContext o) {
+		return Double.compare(getBootID(), o.getBootID());
+	}
 	/**
 	 * Returns true if the last-known build number for this peer is to old to allow traffic to be routed to it.
 	 * This does not give any indication as to the connection status of the peer.