Changeset 27b4803


Ignore:
Timestamp:
May 25, 2011 1:34:32 PM (9 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
82a0ac1
Parents:
641e71c
Message:

b32 cleanups

Location:
core/java/src/net/i2p/client/naming
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • core/java/src/net/i2p/client/naming/BlockfileNamingService.java

    r641e71c r27b4803  
    372372            if (d != null)
    373373                return d;
     374            // Base32 failed?
     375            if (hostname.length() == BASE32_HASH_LENGTH + 8 && hostname.toLowerCase().endsWith(".b32.i2p"))
     376                return null;
    374377        }
    375378
  • core/java/src/net/i2p/client/naming/DummyNamingService.java

    r641e71c r27b4803  
    2020class DummyNamingService extends NamingService {
    2121
    22     private static final int BASE32_HASH_LENGTH = 52;   // 1 + Hash.HASH_LENGTH * 8 / 5
     22    protected static final int BASE32_HASH_LENGTH = 52;   // 1 + Hash.HASH_LENGTH * 8 / 5
    2323    public final static String PROP_B32 = "i2p.naming.hostsTxt.useB32";
    2424    protected static final int CACHE_MAX_SIZE = 32;
     
    4242    }
    4343   
     44    /**
     45     *  @param hostname mixed case as it could be a key
     46     *  @param lookupOptions input parameter, NamingService-specific, can be null
     47     *  @param storedOptions output parameter, NamingService-specific, any stored properties will be added if non-null
     48     *  @return dest or null
     49     *  @since 0.8.7
     50     */
    4451    @Override
    4552    public Destination lookup(String hostname, Properties lookupOptions, Properties storedOptions) {
     
    5764
    5865        // Try Base32 decoding
    59         if (hostname.length() == BASE32_HASH_LENGTH + 8 && hostname.endsWith(".b32.i2p") &&
     66        if (hostname.length() == BASE32_HASH_LENGTH + 8 && hostname.toLowerCase().endsWith(".b32.i2p") &&
    6067            _context.getBooleanPropertyDefaultTrue(PROP_B32)) {
    6168            d = LookupDest.lookupBase32Hash(_context, hostname.substring(0, BASE32_HASH_LENGTH));
     
    7178    /**
    7279     *  Provide basic static caching for all services
     80     *  @param s case-sensitive, could be a hostname or a full b64 string
    7381     */
    7482    protected static void putCache(String s, Destination d) {
     
    8088    }
    8189
    82     /** @return cached dest or null */
     90    /**
     91     *  @param s case-sensitive, could be a hostname or a full b64 string
     92     *  @return cached dest or null
     93     */
    8394    protected static Destination getCache(String s) {
    8495        synchronized (_cache) {
     
    8798    }
    8899
    89     /** @since 0.8.7 */
     100    /**
     101     *  @param s case-sensitive, could be a hostname or a full b64 string
     102     *  @since 0.8.7
     103     */
    90104    protected static void removeCache(String s) {
    91105        synchronized (_cache) {
  • core/java/src/net/i2p/client/naming/EepGetNamingService.java

    r641e71c r27b4803  
    6767
    6868        hostname = hostname.toLowerCase();
     69        // Base32 failed?
     70        if (hostname.length() == BASE32_HASH_LENGTH + 8 && hostname.endsWith(".b32.i2p"))
     71            return null;
    6972
    7073        List URLs = getURLs();
  • core/java/src/net/i2p/client/naming/ExecNamingService.java

    r641e71c r27b4803  
    6565        if (d != null)
    6666            return d;
     67        // Base32 failed?
     68        if (hostname.length() == BASE32_HASH_LENGTH + 8 && hostname.toLowerCase().endsWith(".b32.i2p"))
     69            return null;
    6770
    6871        hostname = hostname.toLowerCase();
  • core/java/src/net/i2p/client/naming/MetaNamingService.java

    r641e71c r27b4803  
    101101        if (d != null)
    102102            return d;
     103        // Base32 failed?
     104        if (hostname.length() == BASE32_HASH_LENGTH + 8 && hostname.toLowerCase().endsWith(".b32.i2p"))
     105            return null;
    103106
    104107        for (NamingService ns : _services) {
  • core/java/src/net/i2p/client/naming/NamingService.java

    r641e71c r27b4803  
    423423     * choose the implementation from the "i2p.naming.impl" system
    424424     * property.
     425     *
     426     * FIXME Actually, it doesn't ensure that. Only call this once!!!
    425427     */
    426428    public static final synchronized NamingService createInstance(I2PAppContext context) {
Note: See TracChangeset for help on using the changeset viewer.