mirror of
https://github.com/oxen-io/session-android.git
synced 2025-08-11 12:47:25 +00:00
Optimise and test IP2Country (#1684)
* Move ipv4Int to top level * Remove redundant fun calls in ipv4ToCountry * Add null safety to loadFile * Close streams on failure * Simplify cacheCountryForIP * Add IP2CountryTest * Generate binary * Simplify ipv4Int * Fix companion object visibility * Use array instead of Treemap * Synchronize OnionApi#paths * Move csv * Deduplicate locations csv * Move ipToCode to gradle * Use std lib binarySearch --------- Co-authored-by: bemusementpark <bemusementpark>
This commit is contained in:
@@ -44,7 +44,8 @@ object OnionRequestAPI {
|
||||
|
||||
var guardSnodes = setOf<Snode>()
|
||||
var _paths: AtomicReference<List<Path>?> = AtomicReference(null)
|
||||
var paths: List<Path> // Not a set to ensure we consistently show the same path to the user
|
||||
var paths: List<Path> // Not a Set to ensure we consistently show the same path to the user
|
||||
@Synchronized
|
||||
get() {
|
||||
val paths = _paths.get()
|
||||
|
||||
@@ -57,6 +58,7 @@ object OnionRequestAPI {
|
||||
_paths.set(result)
|
||||
return result
|
||||
}
|
||||
@Synchronized
|
||||
set(newValue) {
|
||||
if (newValue.isEmpty()) {
|
||||
database.clearOnionRequestPaths()
|
||||
|
Reference in New Issue
Block a user