Author: j16sdiz
Date: 2009-04-22 07:27:19 +0000 (Wed, 22 Apr 2009)
New Revision: 27194

Modified:
   trunk/freenet/src/freenet/node/LocationManager.java
   trunk/freenet/src/freenet/node/NetworkIDManager.java
   trunk/freenet/src/freenet/node/PeerManager.java
Log:
Unused field: NetworkIDManager.disableSwapSegregation

Use getRandomPeer() instead of getRandomPeerInSwappingNetworkOf(),
they are the same when disableSwapSegregation=true.

Modified: trunk/freenet/src/freenet/node/LocationManager.java
===================================================================
--- trunk/freenet/src/freenet/node/LocationManager.java 2009-04-22 06:45:54 UTC 
(rev 27193)
+++ trunk/freenet/src/freenet/node/LocationManager.java 2009-04-22 07:27:19 UTC 
(rev 27194)
@@ -936,7 +936,7 @@
             if(logMINOR) Logger.minor(this, "Forwarding... "+oldID);
             while(true) {
                 // Forward
-                PeerNode randomPeer = 
node.peers.getRandomPeerInSwappingNetworkOf(pn);
+                PeerNode randomPeer = node.peers.getRandomPeer(pn);
                 if(randomPeer == null) {
                        if(logMINOR) Logger.minor(this, "Late reject "+oldID);
                     Message reject = DMT.createFNPSwapRejected(oldID);

Modified: trunk/freenet/src/freenet/node/NetworkIDManager.java
===================================================================
--- trunk/freenet/src/freenet/node/NetworkIDManager.java        2009-04-22 
06:45:54 UTC (rev 27193)
+++ trunk/freenet/src/freenet/node/NetworkIDManager.java        2009-04-22 
07:27:19 UTC (rev 27194)
@@ -33,7 +33,6 @@
 public class NetworkIDManager implements Runnable, 
Comparator<NetworkIDManager.PeerNetworkGroup> {
        public static boolean disableSecretPings = true;
        public static boolean disableSecretPinger = true;
-       public static boolean disableSwapSegregation = true;
        
        private static final int ACCEPTED_TIMEOUT   =  5000;
        private static final int SECRETPONG_TIMEOUT = 20000;

Modified: trunk/freenet/src/freenet/node/PeerManager.java
===================================================================
--- trunk/freenet/src/freenet/node/PeerManager.java     2009-04-22 06:45:54 UTC 
(rev 27193)
+++ trunk/freenet/src/freenet/node/PeerManager.java     2009-04-22 07:27:19 UTC 
(rev 27194)
@@ -624,39 +624,6 @@
                        return locPairs;
        }
 
-       public PeerNode getRandomPeerInSwappingNetworkOf(PeerNode exclude) {
-               if(exclude == null || exclude.networkGroup == null || 
NetworkIDManager.disableSwapSegregation)
-                       return getRandomPeer(exclude);
-               synchronized(this) {
-                       if(connectedPeers.length == 0)
-                               return null;
-                       for(int i = 0; i < 5; i++) {
-                               PeerNode pn = 
connectedPeers[node.random.nextInt(connectedPeers.length)];
-                               if(pn == exclude)
-                                       continue;
-                               if(node.netid.inSeparateNetworks(pn, exclude))
-                                       continue;
-                               if(pn.isRoutable())
-                                       return pn;
-                       }
-                       //could not easily find a good random one... filter the 
ones which are acceptable
-                       ArrayList<PeerNode> l = new ArrayList<PeerNode>();
-                       for(PeerNode pn : connectedPeers) {
-                               if(pn == exclude)
-                                       continue;
-                               if(node.netid.inSeparateNetworks(pn, exclude))
-                                       continue;
-                               if(!pn.isRoutable())
-                                       continue;
-                               l.add(pn);
-                       }
-                       //Are there any acceptable peers?
-                       if(l.size() == 0)
-                               return null;
-                       return l.get(node.random.nextInt(l.size()));
-               }
-       }
-
        /**
         * @return A random routable connected peer.
         * FIXME: should this take performance into account?

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to