whoops 2 un-singletons

This commit is contained in:
zzz
2011-01-13 19:52:11 +00:00
parent 65c6186479
commit c92a8851b2
2 changed files with 7 additions and 4 deletions

View File

@@ -11,7 +11,6 @@ package net.i2p.router.peermanager;
import java.io.IOException; import java.io.IOException;
import java.io.Writer; import java.io.Writer;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.HashSet; import java.util.HashSet;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
@@ -116,7 +115,9 @@ class PeerManager {
*/ */
List<Hash> selectPeers(PeerSelectionCriteria criteria) { List<Hash> selectPeers(PeerSelectionCriteria criteria) {
Set<Hash> peers = new HashSet(criteria.getMinimumRequired()); Set<Hash> peers = new HashSet(criteria.getMinimumRequired());
Set<Hash> exclude = Collections.singleton(_context.routerHash()); // not a singleton, SANFP adds to it
Set<Hash> exclude = new HashSet(1);
exclude.add(_context.routerHash());
switch (criteria.getPurpose()) { switch (criteria.getPurpose()) {
case PeerSelectionCriteria.PURPOSE_TEST: case PeerSelectionCriteria.PURPOSE_TEST:
// for now, the peers we test will be the reliable ones // for now, the peers we test will be the reliable ones

View File

@@ -1,6 +1,6 @@
package net.i2p.router.tunnel.pool; package net.i2p.router.tunnel.pool;
import java.util.Collections; import java.util.HashSet;
import java.util.Set; import java.util.Set;
import net.i2p.crypto.SessionKeyManager; import net.i2p.crypto.SessionKeyManager;
@@ -144,7 +144,9 @@ class TestJob extends JobImpl {
scheduleRetest(); scheduleRetest();
return; return;
} }
Set<SessionTag> encryptTags = Collections.singleton(encryptTag); // can't be a singleton, the SKM modifies it
Set encryptTags = new HashSet(1);
encryptTags.add(encryptTag);
// Register the single tag with the appropriate SKM // Register the single tag with the appropriate SKM
if (_cfg.isInbound() && !_pool.getSettings().isExploratory()) { if (_cfg.isInbound() && !_pool.getSettings().isExploratory()) {
SessionKeyManager skm = getContext().clientManager().getClientSessionKeyManager(_pool.getSettings().getDestination()); SessionKeyManager skm = getContext().clientManager().getClientSessionKeyManager(_pool.getSettings().getDestination());