forked from I2P_Developers/i2p.i2p
Compare commits
1 Commits
i2p.i2p-i2
...
i2p.i2p.2.
Author | SHA1 | Date | |
---|---|---|---|
c6a97a1843 |
@ -211,18 +211,19 @@ class ClientConnectionRunner {
|
||||
_manager.unregisterEncryptedDestination(this, _encryptedLSHash);
|
||||
_manager.unregisterConnection(this);
|
||||
// netdb may be null in unit tests
|
||||
if (_context.netDb() != null) {
|
||||
String dbid = this.getDestHash().toBase32();
|
||||
if (_context.netDb().getSubNetDB(dbid) != null) {
|
||||
// Note that if the client sent us a destroy message,
|
||||
// removeSession() was called just before this, and
|
||||
// _sessions will be empty.
|
||||
for (SessionParams sp : _sessions.values()) {
|
||||
LeaseSet ls = sp.currentLeaseSet;
|
||||
if (ls != null)
|
||||
_context.netDb().unpublish(ls);
|
||||
_context.netDb().getSubNetDB(dbid).unpublish(ls);
|
||||
// unpublish encrypted LS also
|
||||
ls = sp.currentEncryptedLeaseSet;
|
||||
if (ls != null)
|
||||
_context.netDb().unpublish(ls);
|
||||
_context.netDb().getSubNetDB(dbid).unpublish(ls);
|
||||
if (!sp.isPrimary)
|
||||
_context.tunnelManager().removeAlias(sp.dest);
|
||||
}
|
||||
@ -448,6 +449,7 @@ class ClientConnectionRunner {
|
||||
if (id == null)
|
||||
return;
|
||||
boolean isPrimary = false;
|
||||
String dbid = this.getDestHash().toBase32();
|
||||
for (Iterator<SessionParams> iter = _sessions.values().iterator(); iter.hasNext(); ) {
|
||||
SessionParams sp = iter.next();
|
||||
if (id.equals(sp.sessionId)) {
|
||||
@ -458,11 +460,11 @@ class ClientConnectionRunner {
|
||||
_manager.unregisterSession(id, sp.dest);
|
||||
LeaseSet ls = sp.currentLeaseSet;
|
||||
if (ls != null)
|
||||
_context.netDb().unpublish(ls);
|
||||
_context.netDb().getSubNetDB(dbid).unpublish(ls);
|
||||
// unpublish encrypted LS also
|
||||
ls = sp.currentEncryptedLeaseSet;
|
||||
if (ls != null)
|
||||
_context.netDb().unpublish(ls);
|
||||
_context.netDb().getSubNetDB(dbid).unpublish(ls);
|
||||
isPrimary = sp.isPrimary;
|
||||
if (isPrimary)
|
||||
_context.tunnelManager().removeTunnels(sp.dest);
|
||||
@ -483,11 +485,11 @@ class ClientConnectionRunner {
|
||||
_manager.unregisterSession(sp.sessionId, sp.dest);
|
||||
LeaseSet ls = sp.currentLeaseSet;
|
||||
if (ls != null)
|
||||
_context.netDb().unpublish(ls);
|
||||
_context.netDb().getSubNetDB(dbid).unpublish(ls);
|
||||
// unpublish encrypted LS also
|
||||
ls = sp.currentEncryptedLeaseSet;
|
||||
if (ls != null)
|
||||
_context.netDb().unpublish(ls);
|
||||
_context.netDb().getSubNetDB(dbid).unpublish(ls);
|
||||
_context.tunnelManager().removeAlias(sp.dest);
|
||||
synchronized(this) {
|
||||
if (sp.rerequestTimer != null)
|
||||
|
@ -44,6 +44,7 @@ public class DummyNetworkDatabaseFacade extends SegmentedNetworkDatabaseFacade {
|
||||
|
||||
public void restart() {}
|
||||
public void shutdown() {}
|
||||
public void remove(String dbid){}
|
||||
public void startup() {
|
||||
RouterInfo info = _context.router().getRouterInfo();
|
||||
_routers.put(info.getIdentity().getHash(), info);
|
||||
|
@ -956,4 +956,18 @@ public class FloodfillNetworkDatabaseSegmentor extends SegmentedNetworkDatabaseF
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public void remove(String dbid) {
|
||||
if (dbid != null) {
|
||||
if (dbid.endsWith(".i2p") && !dbid.startsWith("clients_"))
|
||||
dbid = "clients_" + dbid;
|
||||
else if (dbid.equals(""))
|
||||
dbid = MAIN_DBID;
|
||||
GetSubNetDB(dbid).shutdown();
|
||||
_subDBs.remove(dbid);
|
||||
} else {
|
||||
if (_log.shouldLog(Log.DEBUG))
|
||||
_log.debug("remove called with null dbid, refusing to remove main DB");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -332,4 +332,6 @@ public abstract class SegmentedNetworkDatabaseFacade { // extends FloodfillNetwo
|
||||
}
|
||||
|
||||
public abstract String getDbidByHash(Hash clientKey);
|
||||
|
||||
public abstract void remove(String dbid);
|
||||
}
|
||||
|
Reference in New Issue
Block a user