forked from I2P_Developers/i2p.i2p
clear profiles out of memory on shutdown
This commit is contained in:
@ -99,6 +99,11 @@ class PeerManager {
|
||||
}
|
||||
}
|
||||
|
||||
/** @since 0.8.8 */
|
||||
void clearProfiles() {
|
||||
_organizer.clearProfiles();
|
||||
}
|
||||
|
||||
Set selectPeers() {
|
||||
return _organizer.selectAllPeers();
|
||||
}
|
||||
|
@ -47,8 +47,10 @@ public class PeerManagerFacadeImpl implements PeerManagerFacade {
|
||||
public void shutdown() {
|
||||
_log.info("Shutting down the peer manager");
|
||||
_testJob.stopTesting();
|
||||
if (_manager != null)
|
||||
if (_manager != null) {
|
||||
_manager.storeProfiles();
|
||||
_manager.clearProfiles();
|
||||
}
|
||||
}
|
||||
|
||||
public void restart() {
|
||||
|
@ -227,6 +227,19 @@ public class ProfileOrganizer {
|
||||
public boolean isWellIntegrated(Hash peer) { return isX(_wellIntegratedPeers, peer); }
|
||||
public boolean isFailing(Hash peer) { return isX(_failingPeers, peer); }
|
||||
|
||||
/** @since 0.8.8 */
|
||||
void clearProfiles() {
|
||||
getReadLock();
|
||||
try {
|
||||
_failingPeers.clear();
|
||||
_fastPeers.clear();
|
||||
_highCapacityPeers.clear();
|
||||
_notFailingPeers.clear();
|
||||
_notFailingPeersList.clear();
|
||||
_wellIntegratedPeers.clear();
|
||||
} finally { releaseReadLock(); }
|
||||
}
|
||||
|
||||
/**
|
||||
* if a peer sends us more than 5 replies in a searchReply that we cannot
|
||||
* fetch, stop listening to them.
|
||||
|
Reference in New Issue
Block a user