Changeset 8660cf0
- Timestamp:
- Aug 27, 2005 10:15:35 PM (15 years ago)
- Branches:
- master
- Children:
- e313da25
- Parents:
- e0bfdff
- git-author:
- jrandom <jrandom> (08/27/05 22:15:35)
- git-committer:
- zzz <zzz@…> (08/27/05 22:15:35)
- Files:
-
- 1 added
- 20 edited
Legend:
- Unmodified
- Added
- Removed
-
apps/i2ptunnel/jsp/web.xml
re0bfdff r8660cf0 1 <?xml version="1.0" encoding=" UTF-8"?>1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 2 <!DOCTYPE web-app 3 3 PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" -
apps/routerconsole/java/src/net/i2p/router/web/FormHandler.java
re0bfdff r8660cf0 21 21 private String _nonce; 22 22 protected String _action; 23 protected String _passphrase; 23 24 private List _errors; 24 25 private List _notices; … … 33 34 _valid = true; 34 35 _nonce = null; 36 _passphrase = null; 35 37 } 36 38 … … 52 54 public void setNonce(String val) { _nonce = val; } 53 55 public void setAction(String val) { _action = val; } 56 public void setPassphrase(String val) { _passphrase = val; } 54 57 55 58 /** … … 120 123 if ( ( (nonce == null) || (!_nonce.equals(nonce)) ) && 121 124 ( (noncePrev == null) || (!_nonce.equals(noncePrev)) ) ) { 122 addFormError("Invalid nonce, are you being spoofed?"); 123 _valid = false; 125 126 String expected = _context.getProperty("consolePassword"); 127 if ( (expected != null) && (expected.trim().length() > 0) && (expected.equals(_passphrase)) ) { 128 // ok 129 } else { 130 addFormError("Invalid nonce, are you being spoofed?"); 131 _valid = false; 132 } 124 133 } 125 134 } -
apps/routerconsole/jsp/web.xml
re0bfdff r8660cf0 1 <?xml version="1.0" encoding=" UTF-8"?>1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 2 <!DOCTYPE web-app 3 3 PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" -
apps/syndie/java/src/net/i2p/syndie/BlogManager.java
re0bfdff r8660cf0 21 21 private File _cacheDir; 22 22 private File _tempDir; 23 private File _rootDir; 23 24 private Archive _archive; 24 25 … … 26 27 TimeZone.setDefault(TimeZone.getTimeZone("GMT")); 27 28 String rootDir = I2PAppContext.getGlobalContext().getProperty("syndie.rootDir"); 28 if (rootDir == null) 29 rootDir = System.getProperty("user.home"); 30 rootDir = rootDir + File.separatorChar + ".syndie"; 29 if (false) { 30 if (rootDir == null) 31 rootDir = System.getProperty("user.home"); 32 rootDir = rootDir + File.separatorChar + ".syndie"; 33 } else { 34 if (rootDir == null) 35 rootDir = "./syndie"; 36 } 31 37 _instance = new BlogManager(I2PAppContext.getGlobalContext(), rootDir); 32 38 } … … 35 41 public BlogManager(I2PAppContext ctx, String rootDir) { 36 42 _context = ctx; 37 File root = new File(rootDir); 38 root.mkdirs(); 39 _blogKeyDir = new File(root, "blogkeys"); 40 _privKeyDir = new File(root, "privkeys"); 43 _rootDir = new File(rootDir); 44 _rootDir.mkdirs(); 45 readConfig(); 46 _blogKeyDir = new File(_rootDir, "blogkeys"); 47 _privKeyDir = new File(_rootDir, "privkeys"); 41 48 String archiveDir = _context.getProperty("syndie.archiveDir"); 42 49 if (archiveDir != null) 43 50 _archiveDir = new File(archiveDir); 44 51 else 45 _archiveDir = new File( root, "archive");46 _userDir = new File( root, "users");47 _cacheDir = new File( root, "cache");48 _tempDir = new File( root, "temp");52 _archiveDir = new File(_rootDir, "archive"); 53 _userDir = new File(_rootDir, "users"); 54 _cacheDir = new File(_rootDir, "cache"); 55 _tempDir = new File(_rootDir, "temp"); 49 56 _blogKeyDir.mkdirs(); 50 57 _privKeyDir.mkdirs(); … … 55 62 _archive = new Archive(ctx, _archiveDir.getAbsolutePath(), _cacheDir.getAbsolutePath()); 56 63 _archive.regenerateIndex(); 64 } 65 66 private void readConfig() { 67 File config = new File(_rootDir, "syndie.config"); 68 if (config.exists()) { 69 try { 70 Properties p = new Properties(); 71 DataHelper.loadProps(p, config); 72 for (Iterator iter = p.keySet().iterator(); iter.hasNext(); ) { 73 String key = (String)iter.next(); 74 System.setProperty(key, p.getProperty(key)); 75 } 76 } catch (IOException ioe) { 77 ioe.printStackTrace(); 78 } 79 } 80 } 81 82 public void writeConfig() { 83 File config = new File(_rootDir, "syndie.config"); 84 FileOutputStream out = null; 85 try { 86 out = new FileOutputStream(config); 87 for (Iterator iter = _context.getPropertyNames().iterator(); iter.hasNext(); ) { 88 String name = (String)iter.next(); 89 if (name.startsWith("syndie.")) 90 out.write((name + '=' + _context.getProperty(name) + '\n').getBytes()); 91 } 92 } catch (IOException ioe) { 93 ioe.printStackTrace(); 94 } finally { 95 if (out != null) try { out.close(); } catch (IOException ioe) {} 96 } 57 97 } 58 98 -
apps/syndie/java/src/net/i2p/syndie/sml/HTMLRenderer.java
re0bfdff r8660cf0 262 262 */ 263 263 public void receiveBlog(String name, String hash, String tag, long entryId, List locations, String description) { 264 if (!continueBody()) { return; } 265 if (hash == null) return; 266 267 System.out.println("Receiving the blog: " + name + "/" + hash + "/" + tag + "/" + entryId +"/" + locations + ": "+ description); 268 byte blogData[] = Base64.decode(hash); 269 if ( (blogData == null) || (blogData.length != Hash.HASH_LENGTH) ) 270 return; 271 264 272 Blog b = new Blog(); 265 273 b.name = name; … … 271 279 _blogs.add(b); 272 280 273 if (!continueBody()) { return; }274 if (hash == null) return;275 276 System.out.println("Receiving the blog: " + name + "/" + hash + "/" + tag + "/" + entryId +"/" + locations + ": "+ description);277 byte blogData[] = Base64.decode(hash);278 if ( (blogData == null) || (blogData.length != Hash.HASH_LENGTH) )279 return;280 281 Hash blog = new Hash(blogData); 281 282 if (entryId > 0) { … … 307 308 } 308 309 if ( (locations != null) && (locations.size() > 0) ) { 309 _bodyBuffer.append(" <select name=\"archiveLocation\">");310 _bodyBuffer.append(" Archives: "); 310 311 for (int i = 0; i < locations.size(); i++) { 311 312 SafeURL surl = (SafeURL)locations.get(i); 312 _bodyBuffer.append("<option value=\"").append(Base64.encode(surl.toString())).append("\">"); 313 _bodyBuffer.append(sanitizeString(surl.toString())).append("</option>\n"); 314 } 315 _bodyBuffer.append("</select>"); 313 if (_user.getAuthenticated() && _user.getAllowAccessRemote()) 314 _bodyBuffer.append("<a href=\"").append(getArchiveURL(blog, surl)).append("\">").append(sanitizeString(surl.toString())).append("</a> "); 315 else 316 _bodyBuffer.append(sanitizeString(surl.toString())).append(' '); 317 } 316 318 } 317 319 _bodyBuffer.append("] "); … … 657 659 if (!unsafe) return str; 658 660 659 str = str.replace('<', '_'); 660 str = str.replace('>', '-'); 661 str = str.replace('<', '_'); // this should be < 662 str = str.replace('>', '-'); // this should be > 661 663 if (!allowNL) { 662 664 str = str.replace('\n', ' '); … … 669 671 public static final String sanitizeURL(String str) { return Base64.encode(str); } 670 672 public static final String sanitizeTagParam(String str) { 673 str = str.replace('&', '_'); // this should be & 671 674 if (str.indexOf('\"') < 0) 672 675 return sanitizeString(str); … … 754 757 return buf.toString(); 755 758 } 759 public static String getArchiveURL(Hash blog, SafeURL archiveLocation) { 760 return "remote.jsp?" 761 //+ "action=Continue..." // should this be the case? 762 + "&schema=" + sanitizeTagParam(archiveLocation.getSchema()) 763 + "&location=" + sanitizeTagParam(archiveLocation.getLocation()); 764 } 756 765 } -
apps/syndie/java/src/net/i2p/syndie/web/ArchiveServlet.java
re0bfdff r8660cf0 25 25 } else if (path.endsWith(Archive.INDEX_FILE)) { 26 26 renderSummary(resp); 27 } else if (path.endsWith("export.zip")) { 28 ExportServlet.export(req, resp); 27 29 } else { 28 30 String blog = getBlog(path); -
apps/syndie/java/src/net/i2p/syndie/web/RemoteArchiveBean.java
re0bfdff r8660cf0 4 4 import java.text.*; 5 5 import java.util.*; 6 import java.util.zip.*; 6 7 import net.i2p.I2PAppContext; 7 8 import net.i2p.data.*; … … 109 110 } 110 111 112 public void fetchSelectedBulk(User user, Map parameters) { 113 String entries[] = ArchiveViewerBean.getStrings(parameters, "entry"); 114 String action = ArchiveViewerBean.getString(parameters, "action"); 115 if ("Fetch all new entries".equals(action)) { 116 ArchiveIndex localIndex = BlogManager.instance().getArchive().getIndex(); 117 List uris = new ArrayList(); 118 List matches = new ArrayList(); 119 for (Iterator iter = _remoteIndex.getUniqueBlogs().iterator(); iter.hasNext(); ) { 120 Hash blog = (Hash)iter.next(); 121 _remoteIndex.selectMatchesOrderByEntryId(matches, blog, null); 122 for (int i = 0; i < matches.size(); i++) { 123 BlogURI uri = (BlogURI)matches.get(i); 124 if (!localIndex.getEntryIsKnown(uri)) 125 uris.add(uri); 126 } 127 matches.clear(); 128 } 129 entries = new String[uris.size()]; 130 for (int i = 0; i < uris.size(); i++) 131 entries[i] = ((BlogURI)uris.get(i)).toString(); 132 } 133 if ( (entries == null) || (entries.length <= 0) ) return; 134 StringBuffer url = new StringBuffer(512); 135 url.append(buildExportURL()); 136 Set meta = new HashSet(); 137 for (int i = 0; i < entries.length; i++) { 138 BlogURI uri = new BlogURI(entries[i]); 139 if (uri.getEntryId() >= 0) { 140 url.append("entry=").append(uri.toString()).append('&'); 141 meta.add(uri.getKeyHash()); 142 _statusMessages.add("Scheduling blog post fetching for " + HTMLRenderer.sanitizeString(entries[i])); 143 } 144 } 145 for (Iterator iter = meta.iterator(); iter.hasNext(); ) { 146 Hash blog = (Hash)iter.next(); 147 url.append("meta=").append(blog.toBase64()).append('&'); 148 _statusMessages.add("Scheduling blog metadata fetching for " + blog.toBase64()); 149 } 150 List urls = new ArrayList(1); 151 urls.add(url.toString()); 152 List tmpFiles = new ArrayList(1); 153 try { 154 File tmp = File.createTempFile("fetchBulk", ".zip", BlogManager.instance().getTempDir()); 155 tmpFiles.add(tmp); 156 fetch(urls, tmpFiles, user, new BulkFetchListener(tmp)); 157 } catch (IOException ioe) { 158 _statusMessages.add("Internal error creating temporary file to fetch " + HTMLRenderer.sanitizeString(url.toString()) + ": " + ioe.getMessage()); 159 } 160 } 161 162 private String buildExportURL() { 163 String loc = _remoteLocation.trim(); 164 int root = loc.lastIndexOf('/'); 165 return loc.substring(0, root + 1) + "export.zip?"; 166 } 167 111 168 private String buildEntryURL(BlogURI uri) { 112 169 String loc = _remoteLocation.trim(); … … 301 358 } 302 359 360 /** 361 * Receive the status of a fetch for the zip containing blogs and metadata (as generated by 362 * the ExportServlet) 363 */ 364 private class BulkFetchListener implements EepGet.StatusListener { 365 private File _tmp; 366 public BulkFetchListener(File tmp) { 367 _tmp = tmp; 368 } 369 public void attemptFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt, int numRetries, Exception cause) { 370 _statusMessages.add("Attempt " + currentAttempt + " failed after " + bytesTransferred + (cause != null ? cause.getMessage() : "")); 371 } 372 373 public void bytesTransferred(long alreadyTransferred, int currentWrite, long bytesTransferred, long bytesRemaining, String url) {} 374 public void transferComplete(long alreadyTransferred, long bytesTransferred, long bytesRemaining, String url, String outputFile) { 375 _statusMessages.add("Fetch of " + HTMLRenderer.sanitizeString(url.substring(0, url.indexOf('?'))) + " successful, importing the data"); 376 File file = new File(outputFile); 377 ZipInputStream zi = null; 378 try { 379 zi = new ZipInputStream(new FileInputStream(file)); 380 381 while (true) { 382 ZipEntry entry = zi.getNextEntry(); 383 if (entry == null) 384 break; 385 386 ByteArrayOutputStream out = new ByteArrayOutputStream(1024); 387 byte buf[] = new byte[1024]; 388 int read = -1; 389 while ( (read = zi.read(buf)) != -1) 390 out.write(buf, 0, read); 391 392 if (entry.getName().startsWith("meta")) { 393 BlogInfo i = new BlogInfo(); 394 i.load(new ByteArrayInputStream(out.toByteArray())); 395 boolean ok = BlogManager.instance().getArchive().storeBlogInfo(i); 396 if (ok) { 397 _statusMessages.add("Blog info for " + HTMLRenderer.sanitizeString(i.getProperty(BlogInfo.NAME)) + " imported"); 398 } else { 399 _statusMessages.add("Blog info at " + HTMLRenderer.sanitizeString(url) + " was corrupt / invalid / forged"); 400 } 401 } else if (entry.getName().startsWith("entry")) { 402 EntryContainer c = new EntryContainer(); 403 c.load(new ByteArrayInputStream(out.toByteArray())); 404 BlogURI uri = c.getURI(); 405 if ( (uri == null) || (uri.getKeyHash() == null) ) { 406 _statusMessages.add("Blog post " + HTMLRenderer.sanitizeString(entry.getName()) + " was corrupt - no URI"); 407 continue; 408 } 409 Archive a = BlogManager.instance().getArchive(); 410 BlogInfo info = a.getBlogInfo(uri); 411 if (info == null) { 412 _statusMessages.add("Blog post " + HTMLRenderer.sanitizeString(entry.getName()) + " cannot be imported, as we don't have their blog metadata"); 413 continue; 414 } 415 boolean ok = a.storeEntry(c); 416 if (!ok) { 417 _statusMessages.add("Blog post " + uri.toString() + " has an invalid signature"); 418 continue; 419 } else { 420 _statusMessages.add("Blog post " + uri.toString() + " imported"); 421 } 422 } 423 } 424 425 BlogManager.instance().getArchive().regenerateIndex(); 426 } catch (IOException ioe) { 427 ioe.printStackTrace(); 428 _statusMessages.add("Error importing from " + HTMLRenderer.sanitizeString(url) + ": " + ioe.getMessage()); 429 } finally { 430 if (zi != null) try { zi.close(); } catch (IOException ioe) {} 431 file.delete(); 432 } 433 } 434 public void transferFailed(String url, long bytesTransferred, long bytesRemaining, int currentAttempt) { 435 _statusMessages.add("Fetch of " + HTMLRenderer.sanitizeString(url) + " failed after " + bytesTransferred); 436 _tmp.delete(); 437 } 438 } 303 439 304 440 public void postSelectedEntries(User user, Map parameters) { … … 367 503 for (Iterator iter = remoteBlogs.iterator(); iter.hasNext(); ) { 368 504 Hash blog = (Hash)iter.next(); 369 buf = new StringBuffer(1024);505 buf.setLength(0); 370 506 int shownEntries = 0; 371 507 buf.append("<tr><td colspan=\"5\" align=\"left\" valign=\"top\">\n"); … … 404 540 buf.append("</tr>\n"); 405 541 } 542 if (shownEntries > 0) { 543 out.write(buf.toString()); 544 buf.setLength(0); 545 } 546 int remote = shownEntries; 406 547 407 548 // now for posts in known blogs that we have and they don't … … 430 571 } 431 572 432 if (shownEntries > 0) // skip blogs we have already syndicated573 if (shownEntries > remote) // skip blogs we have already syndicated 433 574 out.write(buf.toString()); 434 575 } … … 478 619 out.write("<input type=\"submit\" name=\"action\" value=\"Post selected entries\" /> \n"); 479 620 } 621 out.write("<hr />\n"); 480 622 } 481 623 private final SimpleDateFormat _dateFormat = new SimpleDateFormat("yyyy/MM/dd", Locale.UK); -
apps/syndie/jsp/remote.jsp
re0bfdff r8660cf0 20 20 } else { %>Import from: 21 21 <select name="schema"> 22 <option value="web" >I2P/TOR/Freenet</option>23 <option value="mnet" >MNet</option>24 <option value="feedspace" >Feedspace</option>25 <option value="usenet" >Usenet</option>22 <option value="web" <%=("web".equals(request.getParameter("schema")) ? "selected=\"true\"" : "")%>>I2P/TOR/Freenet</option> 23 <option value="mnet" <%=("mnet".equals(request.getParameter("schema")) ? "selected=\"true\"" : "")%>>MNet</option> 24 <option value="feedspace" <%=("feedspace".equals(request.getParameter("schema")) ? "selected=\"true\"" : "")%>>Feedspace</option> 25 <option value="usenet" <%=("usenet".equals(request.getParameter("schema")) ? "selected=\"true\"" : "")%>>Usenet</option> 26 26 </select> 27 27 Proxy <input type="text" size="10" name="proxyhost" value="localhost" />:<input type="text" size="4" name="proxyport" value="4444" /> 28 <input name="location" size="40" /> <input type="submit" name="action" value="Continue..." /><br /> 28 <input name="location" size="40" value="<%=(request.getParameter("location") != null ? request.getParameter("location") : "")%>" /> 29 <input type="submit" name="action" value="Continue..." /><br /> 29 30 <% 30 31 String action = request.getParameter("action"); … … 34 35 remote.fetchMetadata(user, request.getParameterMap()); 35 36 } else if ("Fetch selected entries".equals(action)) { 36 remote.fetchSelectedEntries(user, request.getParameterMap()); 37 //remote.fetchSelectedEntries(user, request.getParameterMap()); 38 remote.fetchSelectedBulk(user, request.getParameterMap()); 37 39 } else if ("Fetch all new entries".equals(action)) { 38 remote.fetchAllEntries(user, request.getParameterMap()); 40 //remote.fetchAllEntries(user, request.getParameterMap()); 41 remote.fetchSelectedBulk(user, request.getParameterMap()); 39 42 } else if ("Post selected entries".equals(action)) { 40 43 remote.postSelectedEntries(user, request.getParameterMap()); -
apps/syndie/jsp/web.xml
re0bfdff r8660cf0 1 <?xml version="1.0" encoding=" UTF-8"?>1 <?xml version="1.0" encoding="ISO-8859-1"?> 2 2 <!DOCTYPE web-app 3 3 PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN" -
core/java/src/net/i2p/util/LogManager.java
re0bfdff r8660cf0 142 142 Log rv = null; 143 143 String scope = Log.getScope(name, cls); 144 boolean isNew = false; 144 145 synchronized (_logs) { 145 146 rv = (Log)_logs.get(scope); … … 147 148 rv = new Log(this, cls, name); 148 149 _logs.put(scope, rv); 149 } 150 } 151 updateLimit(rv); 150 isNew = true; 151 } 152 } 153 if (isNew) 154 updateLimit(rv); 152 155 return rv; 153 156 } -
history.txt
re0bfdff r8660cf0 1 $Id: history.txt,v 1.229 2005/08/23 16:25:49 jrandom Exp $ 1 $Id: history.txt,v 1.230 2005/08/24 17:55:27 jrandom Exp $ 2 3 2005-08-27 jrandom 4 * Minor logging and optimization tweaks in the router and SDK 5 * Use ISO-8859-1 in the XML files (thanks redzara!) 6 * The consolePassword config property can now be used to bypass the router 7 console's nonce checking, allowing CLI restarts 2 8 3 9 2005-08-24 jrandom -
router/java/src/net/i2p/router/RouterVersion.java
re0bfdff r8660cf0 16 16 */ 17 17 public class RouterVersion { 18 public final static String ID = "$Revision: 1.21 8 $ $Date: 2005/08/23 16:25:49$";18 public final static String ID = "$Revision: 1.219 $ $Date: 2005/08/24 17:55:26 $"; 19 19 public final static String VERSION = "0.6.0.3"; 20 public final static long BUILD = 2;20 public final static long BUILD = 3; 21 21 public static void main(String args[]) { 22 22 System.out.println("I2P Router version: " + VERSION); -
router/java/src/net/i2p/router/client/ClientConnectionRunner.java
re0bfdff r8660cf0 147 147 /** current client's sessionId */ 148 148 SessionId getSessionId() { return _sessionId; } 149 void setSessionId(SessionId id) { _sessionId = id; }149 void setSessionId(SessionId id) { if (id != null) _sessionId = id; } 150 150 /** data for the current leaseRequest, or null if there is no active leaseSet request */ 151 151 LeaseRequestState getLeaseRequest() { return _leaseRequest; } -
router/java/src/net/i2p/router/message/GarlicMessageReceiver.java
re0bfdff r8660cf0 72 72 } 73 73 } else { 74 if (_log.shouldLog(Log.ERROR))75 _log.error("CloveMessageParser failed to decrypt the message [" + message.getUniqueId()76 + "]");77 74 if (_log.shouldLog(Log.WARN)) 78 75 _log.warn("CloveMessageParser failed to decrypt the message [" + message.getUniqueId() -
router/java/src/net/i2p/router/networkdb/kademlia/KBucketImpl.java
re0bfdff r8660cf0 13 13 import java.util.Iterator; 14 14 import java.util.Set; 15 import java.util.ArrayList; 16 import java.util.List; 15 17 16 18 import net.i2p.I2PAppContext; … … 23 25 private Log _log; 24 26 /** set of Hash objects for the peers in the kbucket */ 25 private Set _entries;27 private List _entries; 26 28 /** we center the kbucket set on the given hash, and derive distances from this */ 27 29 private Hash _local; … … 35 37 _context = context; 36 38 _log = context.logManager().getLog(KBucketImpl.class); 37 _entries = new HashSet();39 _entries = new ArrayList(64); //new HashSet(); 38 40 setLocal(local); 39 41 } … … 194 196 Set entries = new HashSet(64); 195 197 synchronized (_entries) { 196 entries.addAll(_entries); 198 for (int i = 0; i < _entries.size(); i++) 199 entries.add((Hash)_entries.get(i)); 197 200 } 198 201 return entries; … … 201 204 Set entries = new HashSet(64); 202 205 synchronized (_entries) { 203 entries.addAll(_entries); 206 for (int i = 0; i < _entries.size(); i++) 207 entries.add((Hash)_entries.get(i)); 204 208 entries.removeAll(toIgnoreHashes); 205 209 } … … 209 213 public void getEntries(SelectionCollector collector) { 210 214 synchronized (_entries) { 211 for (Iterator iter = _entries.iterator(); iter.hasNext(); ) { 212 collector.add((Hash)iter.next()); 215 for (int i = 0; i < _entries.size(); i++) 216 collector.add((Hash)_entries.get(i)); 217 } 218 } 219 220 public void setEntries(Set entries) { 221 synchronized (_entries) { 222 _entries.clear(); 223 for (Iterator iter = entries.iterator(); iter.hasNext(); ) { 224 Hash entry = (Hash)iter.next(); 225 if (!_entries.contains(entry)) 226 _entries.add(entry); 213 227 } 214 228 } 215 229 } 216 230 217 public void setEntries(Set entries) {218 synchronized (_entries) {219 _entries.clear();220 _entries.addAll(entries);221 }222 }223 224 231 public int add(Hash peer) { 225 232 synchronized (_entries) { 226 _entries.add(peer); 233 if (!_entries.contains(peer)) 234 _entries.add(peer); 227 235 return _entries.size(); 228 236 } -
router/java/src/net/i2p/router/networkdb/kademlia/KademliaNetworkDatabaseFacade.java
re0bfdff r8660cf0 808 808 809 809 /** smallest allowed period */ 810 private static final int MIN_PER_PEER_TIMEOUT = 1*1000;810 private static final int MIN_PER_PEER_TIMEOUT = 2*1000; 811 811 private static final int MAX_PER_PEER_TIMEOUT = 5*1000; 812 812 -
router/java/src/net/i2p/router/networkdb/kademlia/RepublishLeaseSetJob.java
re0bfdff r8660cf0 85 85 if (_log.shouldLog(Log.WARN)) 86 86 _log.warn("FAILED publishing of the leaseSet for " + _dest.toBase64()); 87 RepublishLeaseSetJob.this.requeue( 30*1000);87 RepublishLeaseSetJob.this.requeue(getContext().random().nextInt(60*1000)); 88 88 } 89 89 } -
router/java/src/net/i2p/router/networkdb/kademlia/StoreJob.java
re0bfdff r8660cf0 40 40 private PeerSelector _peerSelector; 41 41 42 private final static int PARALLELIZATION = 3; // how many sent at a time43 private final static int REDUNDANCY = 6; // we want the data sent to 6 peers42 private final static int PARALLELIZATION = 4; // how many sent at a time 43 private final static int REDUNDANCY = 4; // we want the data sent to 6 peers 44 44 /** 45 45 * additionally send to 1 outlier(s), in case all of the routers chosen in our … … 76 76 getContext().statManager().createRateStat("netDb.storeFailedPeers", "How many peers each netDb must be sent to before failing completely?", "NetworkDatabase", new long[] { 5*60*1000l, 60*60*1000l, 24*60*60*1000l }); 77 77 getContext().statManager().createRateStat("netDb.ackTime", "How long does it take for a peer to ack a netDb store?", "NetworkDatabase", new long[] { 5*60*1000l, 60*60*1000l, 24*60*60*1000l }); 78 getContext().statManager().createRateStat("netDb.replyTimeout", "How long after a netDb send does the timeout expire (when the peer doesn't reply in time)?", "NetworkDatabase", new long[] { 60*1000, 5*60*1000l, 60*60*1000l, 24*60*60*1000l }); 78 79 _facade = facade; 79 80 _state = new StoreState(getContext(), key, data, toSkip); … … 155 156 } else { 156 157 int peerTimeout = _facade.getPeerTimeout(peer); 157 //RateStat failing = prof.getDBHistory().getFailedLookupRate(); 158 //Rate failed = failing.getRate(60*60*1000); 158 PeerProfile prof = getContext().profileOrganizer().getProfile(peer); 159 RateStat failing = prof.getDBHistory().getFailedLookupRate(); 160 Rate failed = failing.getRate(60*60*1000); 161 long failedCount = failed.getCurrentEventCount()+failed.getLastEventCount(); 162 if (failedCount > 10) { 163 _state.addSkipped(peer); 164 continue; 165 } 166 // 159 167 //if (failed.getCurrentEventCount() + failed.getLastEventCount() > avg) { 160 168 // _state.addSkipped(peer); … … 251 259 252 260 SendSuccessJob onReply = new SendSuccessJob(getContext(), peer); 253 FailedJob onFail = new FailedJob(getContext(), peer );261 FailedJob onFail = new FailedJob(getContext(), peer, getContext().clock().now()); 254 262 StoreMessageSelector selector = new StoreMessageSelector(getContext(), getJobId(), peer, token, expiration); 255 263 … … 322 330 private class FailedJob extends JobImpl { 323 331 private RouterInfo _peer; 324 325 public FailedJob(RouterContext enclosingContext, RouterInfo peer) { 332 private long _sendOn; 333 334 public FailedJob(RouterContext enclosingContext, RouterInfo peer, long sendOn) { 326 335 super(enclosingContext); 327 336 _peer = peer; 337 _sendOn = sendOn; 328 338 } 329 339 public void runJob() { … … 333 343 _state.replyTimeout(_peer.getIdentity().getHash()); 334 344 getContext().profileManager().dbStoreFailed(_peer.getIdentity().getHash()); 345 getContext().statManager().addRateData("netDb.replyTimeout", getContext().clock().now() - _sendOn, 0); 335 346 336 347 sendNext(); -
router/java/src/net/i2p/router/transport/udp/MessageReceiver.java
re0bfdff r8660cf0 114 114 return m; 115 115 } catch (I2NPMessageException ime) { 116 if (_log.shouldLog(Log. ERROR))117 _log. error("Message invalid: " + state, ime);116 if (_log.shouldLog(Log.WARN)) 117 _log.warn("Message invalid: " + state, ime); 118 118 return null; 119 119 } catch (Exception e) { -
router/java/src/net/i2p/router/tunnel/FragmentHandler.java
re0bfdff r8660cf0 149 149 boolean eq = DataHelper.eq(v.getData(), 0, preprocessed, offset + HopProcessor.IV_LENGTH, 4); 150 150 if (!eq) { 151 if (_log.shouldLog(Log. ERROR))152 _log. error("Corrupt tunnel message - verification fails: \n" + Base64.encode(preprocessed, offset+HopProcessor.IV_LENGTH, 4)151 if (_log.shouldLog(Log.WARN)) 152 _log.warn("Corrupt tunnel message - verification fails: \n" + Base64.encode(preprocessed, offset+HopProcessor.IV_LENGTH, 4) 153 153 + "\n" + Base64.encode(v.getData(), 0, 4)); 154 154 if (_log.shouldLog(Log.WARN))
Note: See TracChangeset
for help on using the changeset viewer.