Use snodes returned in 421 response
This commit is contained in:
parent
b798f49512
commit
75ce0f056c
|
@ -317,8 +317,20 @@ object SnodeAPI {
|
||||||
421 -> {
|
421 -> {
|
||||||
// The snode isn't associated with the given public key anymore
|
// The snode isn't associated with the given public key anymore
|
||||||
if (publicKey != null) {
|
if (publicKey != null) {
|
||||||
Log.d("Loki", "Invalidating swarm for: $publicKey.")
|
fun invalidateSwarm() {
|
||||||
dropSnodeFromSwarmIfNeeded(snode, publicKey)
|
Log.d("Loki", "Invalidating swarm for: $publicKey.")
|
||||||
|
dropSnodeFromSwarmIfNeeded(snode, publicKey)
|
||||||
|
}
|
||||||
|
if (json != null) {
|
||||||
|
val snodes = parseSnodes(json)
|
||||||
|
if (snodes.isNotEmpty()) {
|
||||||
|
database.setSwarm(publicKey, snodes.toSet())
|
||||||
|
} else {
|
||||||
|
invalidateSwarm()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
invalidateSwarm()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
Log.d("Loki", "Got a 421 without an associated public key.")
|
Log.d("Loki", "Got a 421 without an associated public key.")
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue