Changeset 896ba7a
- Timestamp:
- Aug 27, 2008 7:58:13 PM (12 years ago)
- Branches:
- master
- Children:
- c321251
- Parents:
- 2c48831
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
history.txt
r2c48831 r896ba7a 1 2008-08-27 zzz 2 * Floodfill Peer Selector: Prefer already-connected floodfill 3 peer for direct RouterInfo stores, to mimimize floodfill 4 connections 5 * Peer Profiles: Classify connected peers as "active", 6 which will help improve the fast pool 7 * Transport Manager: Add isEstablished(Hash) 8 * NTCP: Reduce max idle time from 20m to 15m 9 * NetDb stats: Post-0.6.3 clean up 10 1 11 * 2008-08-24 0.6.3 released 2 12 -
router/java/src/net/i2p/router/CommSystemFacade.java
r2c48831 r896ba7a 57 57 public boolean isBacklogged(Hash dest) { return false; } 58 58 public boolean wasUnreachable(Hash dest) { return false; } 59 public boolean isEstablished(Hash dest) { return false; } 59 60 60 61 /** -
router/java/src/net/i2p/router/RouterVersion.java
r2c48831 r896ba7a 18 18 public final static String ID = "$Revision: 1.548 $ $Date: 2008-06-07 23:00:00 $"; 19 19 public final static String VERSION = "0.6.3"; 20 public final static long BUILD = 0;20 public final static long BUILD = 1; 21 21 public static void main(String args[]) { 22 22 System.out.println("I2P Router version: " + VERSION + "-" + BUILD); -
router/java/src/net/i2p/router/networkdb/kademlia/FloodfillPeerSelector.java
r2c48831 r896ba7a 32 32 * @return List of Hash for the peers selected 33 33 */ 34 public List selectMostReliablePeers(Hash key, int maxNumRouters, Set peersToIgnore, KBucketSet kbuckets) { 35 return selectNearestExplicitThin(key, maxNumRouters, peersToIgnore, kbuckets, true); 36 } 37 34 38 public List selectNearestExplicitThin(Hash key, int maxNumRouters, Set peersToIgnore, KBucketSet kbuckets) { 39 return selectNearestExplicitThin(key, maxNumRouters, peersToIgnore, kbuckets, false); 40 } 41 42 public List selectNearestExplicitThin(Hash key, int maxNumRouters, Set peersToIgnore, KBucketSet kbuckets, boolean preferConnected) { 35 43 if (peersToIgnore == null) 36 44 peersToIgnore = new HashSet(1); … … 39 47 if (kbuckets == null) return new ArrayList(); 40 48 kbuckets.getAll(matches); 41 List rv = matches.get(maxNumRouters );49 List rv = matches.get(maxNumRouters, preferConnected); 42 50 if (_log.shouldLog(Log.DEBUG)) 43 51 _log.debug("Searching for " + maxNumRouters + " peers close to " + key + ": " … … 101 109 /** get the first $howMany entries matching */ 102 110 public List get(int howMany) { 111 return get(howMany, false); 112 } 113 114 public List get(int howMany, boolean preferConnected) { 103 115 Collections.shuffle(_floodfillMatches, _context.random()); 104 116 List rv = new ArrayList(howMany); 105 117 List badff = new ArrayList(howMany); 118 List unconnectedff = new ArrayList(howMany); 106 119 int found = 0; 107 120 long now = _context.clock().now(); … … 122 135 if (_log.shouldLog(Log.DEBUG)) 123 136 _log.debug("Skipping, recent failed send: " + entry); 137 } else if (preferConnected && !_context.commSystem().isEstablished(entry)) { 138 unconnectedff.add(entry); 139 if (_log.shouldLog(Log.DEBUG)) 140 _log.debug("Skipping, unconnected: " + entry); 124 141 } else { 125 142 rv.add(entry); … … 127 144 } 128 145 } 146 } 147 // Put the unconnected floodfills after the connected floodfills 148 for (int i = 0; found < howMany && i < unconnectedff.size(); i++) { 149 rv.add(unconnectedff.get(i)); 150 found++; 129 151 } 130 152 // Put the "bad" floodfills at the end of the floodfills but before the kademlias -
router/java/src/net/i2p/router/networkdb/kademlia/StoreJob.java
r2c48831 r896ba7a 142 142 toCheck = getParallelization(); 143 143 144 List closestHashes = getClosestRouters(_state.getTarget(), toCheck, _state.getAttempted()); 144 // We are going to send the RouterInfo directly, rather than through a lease, 145 // so select a floodfill peer we are already connected to. 146 // This will help minimize active connections for floodfill peers and allow 147 // the network to scale. 148 // Perhaps the ultimate solution is to send RouterInfos through a lease also. 149 List closestHashes; 150 if (_state.getData() instanceof RouterInfo) 151 closestHashes = getMostReliableRouters(_state.getTarget(), toCheck, _state.getAttempted()); 152 else 153 closestHashes = getClosestRouters(_state.getTarget(), toCheck, _state.getAttempted()); 145 154 if ( (closestHashes == null) || (closestHashes.size() <= 0) ) { 146 155 if (_state.getPending().size() <= 0) { … … 217 226 } 218 227 228 private List getMostReliableRouters(Hash key, int numClosest, Set alreadyChecked) { 229 Hash rkey = getContext().routingKeyGenerator().getRoutingKey(key); 230 KBucketSet ks = _facade.getKBuckets(); 231 if (ks == null) return new ArrayList(); 232 return _peerSelector.selectMostReliablePeers(rkey, numClosest, alreadyChecked, ks); 233 } 234 219 235 /** 220 236 * Send a store to the given peer through a garlic route, including a reply -
router/java/src/net/i2p/router/peermanager/PeerProfile.java
r2c48831 r896ba7a 95 95 * Is this peer active at the moment (sending/receiving messages within the 96 96 * given period?) 97 * Also mark active if it is connected, as this will tend to encourage use 98 * of already-connected peers. 97 99 */ 98 100 public boolean getIsActive(long period) { … … 100 102 (getSendSuccessSize().getRate(period).getLastEventCount() > 0) || 101 103 (getReceiveSize().getRate(period).getCurrentEventCount() > 0) || 102 (getReceiveSize().getRate(period).getLastEventCount() > 0) ) 104 (getReceiveSize().getRate(period).getLastEventCount() > 0) || 105 _context.commSystem().isEstablished(_peer) ) 103 106 return true; 104 107 else -
router/java/src/net/i2p/router/transport/CommSystemFacadeImpl.java
r2c48831 r896ba7a 124 124 public boolean isBacklogged(Hash dest) { 125 125 return _manager.isBacklogged(dest); 126 } 127 128 public boolean isEstablished(Hash dest) { 129 return _manager.isEstablished(dest); 126 130 } 127 131 -
router/java/src/net/i2p/router/transport/Transport.java
r2c48831 r896ba7a 51 51 52 52 public boolean isUnreachable(Hash peer); 53 public boolean isEstablished(Hash peer); 53 54 } -
router/java/src/net/i2p/router/transport/TransportImpl.java
r2c48831 r896ba7a 396 396 public void recheckReachability() {} 397 397 public boolean isBacklogged(Hash dest) { return false; } 398 public boolean isEstablished(Hash dest) { return false; } 398 399 399 400 private static final long UNREACHABLE_PERIOD = 5*60*1000; -
router/java/src/net/i2p/router/transport/TransportManager.java
r2c48831 r896ba7a 204 204 } 205 205 206 public boolean isEstablished(Hash dest) { 207 for (int i = 0; i < _transports.size(); i++) { 208 Transport t = (Transport)_transports.get(i); 209 if (t.isEstablished(dest)) 210 return true; 211 } 212 return false; 213 } 214 206 215 /** 207 216 * Was the peer UNreachable (outbound only) on any transport, -
router/java/src/net/i2p/router/transport/ntcp/NTCPTransport.java
r2c48831 r896ba7a 337 337 338 338 private boolean isEstablished(RouterIdentity peer) { 339 return isEstablished(peer.calculateHash()); 340 } 341 342 public boolean isEstablished(Hash dest) { 339 343 synchronized (_conLock) { 340 NTCPConnection con = (NTCPConnection)_conByIdent.get( peer.calculateHash());344 NTCPConnection con = (NTCPConnection)_conByIdent.get(dest); 341 345 return (con != null) && con.isEstablished() && !con.isClosed(); 342 346 } -
router/java/src/net/i2p/router/transport/udp/UDPTransport.java
r2c48831 r896ba7a 1267 1267 } 1268 1268 1269 public boolean isEstablished(Hash dest) { 1270 return getPeerState(dest) != null; 1271 } 1272 1269 1273 /** 1270 1274 * Return our peer clock skews on this transport.
Note: See TracChangeset
for help on using the changeset viewer.