diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt index 66a9b22c35..acdad276d9 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/AppModules.kt @@ -559,9 +559,6 @@ class AppModules( // once restored, every previously-seen host hits the stale-while-revalidate path // instead of blocking on getaddrinfo. applicationIOScope.launch { - // One-shot reclaim of the legacy SharedPreferences blob — SurgeDnsStore moved - // from storage to cacheDir. - appContext.deleteSharedPreferences("amethyst_dns_cache") dnsStore.load() } diff --git a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/okhttp/SurgeDnsStore.kt b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/okhttp/SurgeDnsStore.kt index 5eb87da80a..bfbaa0ed54 100644 --- a/amethyst/src/main/java/com/vitorpamplona/amethyst/service/okhttp/SurgeDnsStore.kt +++ b/amethyst/src/main/java/com/vitorpamplona/amethyst/service/okhttp/SurgeDnsStore.kt @@ -71,12 +71,6 @@ class SurgeDnsStore( * call from a background thread. */ fun load() { - // One-shot reclaim of the legacy JSON blob — this class moved to a binary format. Done - // here (not in the constructor) so the syscall happens on the load() background thread - // instead of whatever thread builds the store. - val legacy = File(file.parentFile, LEGACY_FILE_NAME) - if (legacy.exists()) legacy.delete() - if (!file.exists()) return val records = try { @@ -192,7 +186,6 @@ class SurgeDnsStore( companion object { private const val TAG = "SurgeDnsStore" const val FILE_NAME = "dns_cache_v1.bin" - private const val LEGACY_FILE_NAME = "dns_cache_v1.json" // 'SNSC' — Surge dNS Cache. private const val MAGIC = 0x534E5343 diff --git a/amethyst/src/test/java/com/vitorpamplona/amethyst/service/okhttp/SurgeDnsStoreTest.kt b/amethyst/src/test/java/com/vitorpamplona/amethyst/service/okhttp/SurgeDnsStoreTest.kt index 57cb1c3346..730bdbb2f1 100644 --- a/amethyst/src/test/java/com/vitorpamplona/amethyst/service/okhttp/SurgeDnsStoreTest.kt +++ b/amethyst/src/test/java/com/vitorpamplona/amethyst/service/okhttp/SurgeDnsStoreTest.kt @@ -155,19 +155,4 @@ class SurgeDnsStoreTest { store.load() // must not throw assertTrue(dns.snapshot().isEmpty()) } - - @Test - fun `load deletes the legacy json sibling`() { - val legacy = File(tempFolder.root, "dns_cache_v1.json") - legacy.writeText("[]") - assertTrue(legacy.exists()) - - val target = File(tempFolder.root, "dns_cache_v1.bin") - val (store, _) = newStore(target) - // Construction must not touch the filesystem — only load() may. - assertTrue("constructor should not delete legacy file", legacy.exists()) - - store.load() - assertFalse("legacy json blob should be reclaimed by load()", legacy.exists()) - } }