Changeset c7d0526
- Timestamp:
- May 9, 2019 8:11:03 PM (21 months ago)
- Branches:
- master
- Children:
- d8980d1
- Parents:
- de8a079
- Location:
- router/java/src/net/i2p/router
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
router/java/src/net/i2p/router/CommSystemFacade.java
rde8a079 rc7d0526 184 184 */ 185 185 public DHSessionKeyBuilder.Factory getDHFactory() { return null; } 186 187 /** 188 * Router must call after netdb is initialized 189 * @since 0.9.41 190 */ 191 public void initGeoIP() {} 186 192 187 193 /* -
router/java/src/net/i2p/router/Router.java
rde8a079 rc7d0526 876 876 // but just to be safe 877 877 _context.simpleTimer2().addEvent(r, 0); 878 _context.commSystem().initGeoIP(); 878 879 } 879 880 } -
router/java/src/net/i2p/router/transport/CommSystemFacadeImpl.java
rde8a079 rc7d0526 33 33 import net.i2p.util.SimpleTimer; 34 34 import net.i2p.util.SimpleTimer2; 35 import net.i2p.util.SystemVersion; 35 36 import net.i2p.util.Translate; 36 37 … … 56 57 _geoIP = new GeoIP(_context); 57 58 _manager = new TransportManager(_context); 58 startGeoIP();59 59 } 60 60 … … 364 364 */ 365 365 366 /** 367 * Router must call after netdb is initialized 368 * @since 0.9.41 369 */ 370 @Override 371 public void initGeoIP() { 372 startGeoIP(); 373 } 374 366 375 /* We hope the routerinfos are read in and things have settled down by now, but it's not required to be so */ 367 private static final int START_DELAY = 5*60*1000;376 private static final int START_DELAY = SystemVersion.isSlow() ? 5*60*1000 : 5*1000; 368 377 private static final int LOOKUP_TIME = 30*60*1000; 369 378 -
router/java/src/net/i2p/router/transport/GeoIP.java
rde8a079 rc7d0526 127 127 * Results will be added to the table and available via get() after completion. 128 128 */ 129 publicvoid blockingLookup() {129 void blockingLookup() { 130 130 if (! _context.getBooleanPropertyDefaultTrue(PROP_GEOIP_ENABLED)) { 131 131 _pendingSearch.clear(); … … 154 154 File geoip2 = getGeoIP2(); 155 155 DatabaseReader dbr = null; 156 long start = _context.clock().now(); 156 157 try { 157 158 // clear the negative cache every few runs, to prevent it from getting too big … … 296 297 _lock.set(false); 297 298 } 299 if (_log.shouldInfo()) 300 _log.info("GeoIP processing finished, time: " + (_context.clock().now() - start)); 298 301 } 299 302 } … … 424 427 String[] rv = new String[search.length]; 425 428 int idx = 0; 426 long start = _context.clock().now();427 429 BufferedReader br = null; 428 430 try { … … 460 462 } 461 463 462 if (_log.shouldLog(Log.INFO)) {463 _log.info("GeoIP processing finished, time: " + (_context.clock().now() - start));464 }465 464 return rv; 466 465 } … … 500 499 * @param ip IPv4 or IPv6 501 500 */ 502 publicvoid add(String ip) {501 void add(String ip) { 503 502 byte[] pib = Addresses.getIP(ip); 504 503 if (pib == null) return; … … 510 509 * @param ip IPv4 or IPv6 511 510 */ 512 publicvoid add(byte ip[]) {511 void add(byte ip[]) { 513 512 add(toLong(ip)); 514 513 } … … 530 529 * @return lower-case code, generally two letters, or null. 531 530 */ 532 publicString get(String ip) {531 String get(String ip) { 533 532 byte[] pib = Addresses.getIP(ip); 534 533 if (pib == null) return null; … … 541 540 * @return lower-case code, generally two letters, or null. 542 541 */ 543 publicString get(byte ip[]) {542 String get(byte ip[]) { 544 543 return get(toLong(ip)); 545 544 } … … 598 597 * @return untranslated name or null 599 598 */ 600 publicString fullName(String code) {599 String fullName(String code) { 601 600 return _codeToName.get(code); 602 601 }
Note: See TracChangeset
for help on using the changeset viewer.