Warning: session_start(): open(/var/lib/php/sessions/sess_87r2jknr1546b36kca17i3g1n3, O_RDWR) failed: No space left on device (28) in /var/www/tb-usercake/models/config.php on line 51
Warning: session_start(): Failed to read session data: files (path: /var/lib/php/sessions) in /var/www/tb-usercake/models/config.php on line 51
static NavigableMap ipToCountry_data = new TreeMap; //synchroNavigableTreeMap();
static Lock ipToCountry_lock = lock();
static S ipToCountry(S ip) null on exception {
long ipNum = ipToInt(trim(ip));
lock ipToCountry_lock;
ipToCountry_init();
Long key = ipToCountry_data.floorKey(ipNum);
ret key == null ? null : ipToCountry_data.get(key);
}
static void ipToCountry_init() {
lock ipToCountry_lock;
if (nempty(ipToCountry_data)) ret;
long start = 0;
for (S s : linesFromReader(utf8bufferedReader(gzInputStream(loadLibrary(#1008743))))) {
L l = splitAtSpace(s);
if (l(l) < 2) continue;
long diff = parseLong(first(l));
S country = intern(last(l));
start += diff;
ipToCountry_data.put(start, country);
}
}
static void ipToCountry_clearCache() {
lock ipToCountry_lock;
ipToCountry_data.clear();
}