@Override public void sendStore( Hash key, DatabaseEntry ds, Job onSuccess, Job onFailure, long sendTimeout, Set toIgnore) { // if we are a part of the floodfill netDb, don't send out our own leaseSets as part // of the flooding - instead, send them to a random floodfill peer so *they* can flood 'em out. // perhaps statistically adjust this so we are the source every 1/N times... or something. if (floodfillEnabled() && (ds.getType() == DatabaseEntry.KEY_TYPE_ROUTERINFO)) { flood(ds); if (onSuccess != null) _context.jobQueue().addJob(onSuccess); } else { _context .jobQueue() .addJob( new FloodfillStoreJob( _context, this, key, ds, onSuccess, onFailure, sendTimeout, toIgnore)); } }
/** * If we are floodfill, turn it off and tell everybody. * * @since 0.8.9 */ @Override public synchronized void shutdown() { if (_floodfillEnabled) { // turn off to build a new RI... _floodfillEnabled = false; // true -> publish inline // but job queue is already shut down, so sendStore() called by rebuildRouterInfo() won't // work... _context.router().rebuildRouterInfo(true); // ...so force a flood here RouterInfo local = _context.router().getRouterInfo(); if (local != null && _context.router().getUptime() > PUBLISH_JOB_DELAY) { flood(local); // let the messages get out... try { Thread.sleep(3000); } catch (InterruptedException ie) { } } } super.shutdown(); }