Changeset a8ad30b3 for router


Ignore:
Timestamp:
Apr 18, 2019 12:46:51 PM (15 months ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
ea7ddaf
Parents:
67570db
Message:

PeerManager? API cleanup (ticket #2456)

Location:
router/java/src/net/i2p/router
Files:
5 edited
1 moved

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/PeerManagerFacade.java

    r67570db ra8ad30b3  
    2121 */
    2222public interface PeerManagerFacade extends Service {
    23     /**
    24      * Select peers from the manager's existing routing tables according to
    25      * the specified criteria.  This call DOES block.
    26      *
    27      * @return List of Hash objects of the RouterIdentity for matching peers
    28      */
    29     public List<Hash> selectPeers(PeerSelectionCriteria criteria);
    3023    public Set<Hash> getPeersByCapability(char capability);
    3124    public void setCapabilities(Hash peer, String caps);
  • router/java/src/net/i2p/router/dummy/DummyPeerManagerFacade.java

    r67570db ra8ad30b3  
    1515import net.i2p.data.Hash;
    1616import net.i2p.router.PeerManagerFacade;
    17 import net.i2p.router.PeerSelectionCriteria;
    1817
    1918/**
     
    2827    public void restart() {}
    2928    public void renderStatusHTML(Writer out) { }   
    30     public List<Hash> selectPeers(PeerSelectionCriteria criteria) { return null; }
    3129    public Set<Hash> getPeersByCapability(char capability) { return null; }
    3230    public void setCapabilities(Hash peer, String caps) {}
  • router/java/src/net/i2p/router/peermanager/PeerManager.java

    r67570db ra8ad30b3  
    2222import net.i2p.data.Hash;
    2323import net.i2p.data.router.RouterInfo;
    24 import net.i2p.router.PeerSelectionCriteria;
    2524import net.i2p.router.Router;
    2625import net.i2p.router.RouterContext;
     
    246245                _organizer.selectActiveNotFailingPeers(criteria.getMinimumRequired(), exclude, peers);
    247246                break;
     247/****
    248248            case PeerSelectionCriteria.PURPOSE_TUNNEL:
    249249                // pull all of the fast ones, regardless of how many we
     
    261261                _organizer.selectHighCapacityPeers(criteria.getMinimumRequired(), exclude, peers);
    262262                break;
     263****/
    263264            default:
    264                 break;
     265                throw new UnsupportedOperationException();
    265266        }
    266267        if (peers.isEmpty()) {
  • router/java/src/net/i2p/router/peermanager/PeerManagerFacadeImpl.java

    r67570db ra8ad30b3  
    1717import net.i2p.data.Hash;
    1818import net.i2p.router.PeerManagerFacade;
    19 import net.i2p.router.PeerSelectionCriteria;
    2019import net.i2p.router.RouterContext;
    2120import net.i2p.util.Log;
     
    6160    }
    6261   
    63     public List<Hash> selectPeers(PeerSelectionCriteria criteria) {
    64         return _manager.selectPeers(criteria);
    65     }
    66 
    6762    /**
    6863     *  @param caps non-null
  • router/java/src/net/i2p/router/peermanager/PeerSelectionCriteria.java

    r67570db ra8ad30b3  
    1 package net.i2p.router;
     1package net.i2p.router.peermanager;
    22/*
    33 * free (adj.): unencumbered; not under the control of others
     
    1414 *
    1515 * Only used by PeerTestJob, which may not have a point.
     16 *
     17 * @since moved from router to peermanager in 0.9.40
    1618 */
    17 public class PeerSelectionCriteria {
     19class PeerSelectionCriteria {
    1820    /** The peers will be used in a tunnel */
    19     public final static int PURPOSE_TUNNEL = 1;
     21    //public final static int PURPOSE_TUNNEL = 1;
    2022    /** The peers will be used for garlic routed messages */
    21     public final static int PURPOSE_GARLIC = 2;
     23    //public final static int PURPOSE_GARLIC = 2;
    2224    /** The peers will be used for a source routed reply block message */
    23     public final static int PURPOSE_SOURCE_ROUTE = 3;
     25    //public final static int PURPOSE_SOURCE_ROUTE = 3;
    2426    /** The peers will be used for a test message */
    2527    public final static int PURPOSE_TEST = 4;
  • router/java/src/net/i2p/router/peermanager/PeerTestJob.java

    r67570db ra8ad30b3  
    1313import net.i2p.router.JobImpl;
    1414import net.i2p.router.MessageSelector;
    15 import net.i2p.router.PeerSelectionCriteria;
    1615import net.i2p.router.ReplyJob;
    1716import net.i2p.router.RouterContext;
     
    2827 * TODO - Use something besides sending the peer's RI to itself?
    2928 */
    30 public class PeerTestJob extends JobImpl {
     29class PeerTestJob extends JobImpl {
    3130    private final Log _log;
    3231    private PeerManager _manager;
     
    5049    private int getTestConcurrency() { return 1; }
    5150   
    52     // FIXME Exporting non-public type through public API FIXME
    5351    public synchronized void startTesting(PeerManager manager) {
    5452        _manager = manager;
Note: See TracChangeset for help on using the changeset viewer.