mirror of
https://github.com/element-hq/element-android
synced 2024-11-27 11:59:12 +03:00
Comments and error mapping
This commit is contained in:
parent
4306c57236
commit
fb86ab70a2
1 changed files with 5 additions and 4 deletions
|
@ -99,9 +99,8 @@ class SimpleHttpRendezvousTransport(override var onCancelled: ((reason: Rendezvo
|
|||
|
||||
override suspend fun receive(): ByteArray? {
|
||||
val uri = uri ?: throw IllegalStateException("Rendezvous not set up")
|
||||
var done = false
|
||||
val httpClient = okhttp3.OkHttpClient.Builder().build()
|
||||
while (!done) {
|
||||
while (true) {
|
||||
if (cancelled) {
|
||||
return null
|
||||
}
|
||||
|
@ -117,8 +116,9 @@ class SimpleHttpRendezvousTransport(override var onCancelled: ((reason: Rendezvo
|
|||
val response = httpClient.newCall(request.build()).execute()
|
||||
|
||||
try {
|
||||
// expired
|
||||
if (response.code == 404) {
|
||||
cancel(RendezvousFailureReason.Unknown)
|
||||
cancel(RendezvousFailureReason.Expired)
|
||||
return null
|
||||
}
|
||||
|
||||
|
@ -135,7 +135,8 @@ class SimpleHttpRendezvousTransport(override var onCancelled: ((reason: Rendezvo
|
|||
return response.body?.bytes()
|
||||
}
|
||||
|
||||
done = false
|
||||
// sleep for a second before polling again
|
||||
// we rely on the server expiring the channel rather than checking it ourselves
|
||||
delay(1000)
|
||||
} finally {
|
||||
response.close()
|
||||
|
|
Loading…
Reference in a new issue