Changeset 5ef3254


Ignore:
Timestamp:
Mar 7, 2008 2:31:36 PM (13 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
0c75725
Parents:
d957712
Message:

Optimize naming lookups for a destkey

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

Legend:

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

    rd957712 r5ef3254  
    6464       
    6565    public Destination lookup(String hostname) {
     66        // If it's long, assume it's a key.
     67        if (hostname.length() >= DEST_SIZE)
     68            return lookupBase64(hostname);
     69
    6670        hostname = hostname.toLowerCase();
    6771
     
    96100            }
    97101        }
    98 
    99         // If we can't find name,
    100         // assume it's a key.
    101         return lookupBase64(hostname);
     102        return null;
    102103    }
    103104
  • core/java/src/net/i2p/client/naming/ExecNamingService.java

    rd957712 r5ef3254  
    6565       
    6666    public Destination lookup(String hostname) {
     67        // If it's long, assume it's a key.
     68        if (hostname.length() >= DEST_SIZE)
     69            return lookupBase64(hostname);
     70
    6771        hostname = hostname.toLowerCase();
    6872
     
    8185            return lookupBase64(key);
    8286        }
    83 
    84         // If we can't find name,
    85         // assume it's a key.
    86         return lookupBase64(hostname);
     87        return null;
    8788    }
    8889
  • core/java/src/net/i2p/client/naming/HostsTxtNamingService.java

    rd957712 r5ef3254  
    5555       
    5656    public Destination lookup(String hostname) {
     57        // If it's long, assume it's a key.
     58        if (hostname.length() >= 516)
     59            return lookupBase64(hostname);
     60
    5761        // check the list each time, reloading the file on each
    5862        // lookup
     
    8084            // not found, continue to the next file
    8185        }
    82         // If we can't find name in any of the hosts files,
    83         // assume it's a key.
    84         return lookupBase64(hostname);
     86        return null;
    8587    }
    8688
Note: See TracChangeset for help on using the changeset viewer.