Changeset 8eb6dc0 for router


Ignore:
Timestamp:
Jun 16, 2018 5:23:57 PM (2 years ago)
Author:
zzz <zzz@…>
Branches:
master
Children:
d500f61
Parents:
dd5c4af
Message:

GeoIP: Don't log error message when hitting the end
of the geoipv6.dat file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • router/java/src/net/i2p/router/transport/GeoIPv6.java

    rdd5c4af r8eb6dc0  
    88import java.io.BufferedOutputStream;
    99import java.io.BufferedReader;
     10import java.io.EOFException;
    1011import java.io.IOException;
    1112import java.io.File;
     
    5354     * @param search a sorted array of IPs to search
    5455     * @return an array of country codes, same order as the search param,
    55      *         or a zero-length array on failure
     56     *         or a zero-length array on total failure.
     57     *         Individual array elements will be null for lookup failure of that item.
    5658     */
    5759    public static String[] readGeoIPFile(I2PAppContext context, Long[] search, Map<String, String> codeCache) {
     
    7375     * @param search a sorted array of IPs to search
    7476     * @return an array of country codes, same order as the search param,
    75      *         or a zero-length array on failure
     77     *         or a zero-length array on total failure.
     78     *         Individual array elements will be null for lookup failure of that item.
    7679     */
    7780    private static String[] readGeoIPFile(File geoFile, Long[] search, Map<String, String> codeCache, Log log) {
     
    8992            DataHelper.skip(in, HEADER_LEN - MAGIC.length());
    9093            byte[] buf = new byte[18];
    91             while (DataHelper.read(in, buf) == 18 && idx < search.length) {
     94            while (idx < search.length) {
     95                try {
     96                    DataHelper.read(in, buf);
     97                } catch (EOFException eofe) {
     98                    // normal,
     99                    // we could hit the end before finding everything
     100                    break;
     101                }
    92102                long ip1 = readLong(buf, 0);
    93103                long ip2 = readLong(buf, 8);
Note: See TracChangeset for help on using the changeset viewer.