Skip to content

Commit

Permalink
Merge branch 'refs/heads/develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
aleksandar-apostolov committed Jul 3, 2024
2 parents 79a1873 + 2a00903 commit 9005fa2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ object Configuration {
const val minSdk = 24
const val majorVersion = 1
const val minorVersion = 0
const val patchVersion = 8
const val patchVersion = 9
const val versionName = "$majorVersion.$minorVersion.$patchVersion"
const val versionCode = 32
const val versionCode = 33
const val snapshotVersionName = "$majorVersion.$minorVersion.${patchVersion + 1}-SNAPSHOT"
const val artifactGroup = "io.getstream"
const val streamVideoCallGooglePlayVersion = "1.1.4"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ import okhttp3.WebSocket
import okhttp3.WebSocketListener
import org.openapitools.client.models.VideoEvent
import stream.video.sfu.event.HealthCheckRequest
import java.io.EOFException
import java.io.IOException
import java.io.InterruptedIOException
import java.net.ConnectException
Expand Down Expand Up @@ -227,7 +228,7 @@ public open class PersistentSocket<T>(
try {
connectContinuationCompleted = false
connect()
} catch (e: Exception) {
} catch (e: Throwable) {
logger.e { "[reconnect] failed to reconnect: $e" }
}
}
Expand Down Expand Up @@ -290,15 +291,26 @@ public open class PersistentSocket<T>(
}
}

internal fun handleError(error: Throwable) {
internal fun handleError(receivedError: Throwable) {
// onFailure, onClosed and the 2 onMessage can all generate errors
// temporary errors should be logged and retried
// permanent errors should be emitted so the app can decide how to handle it
if (destroyed) {
logger.d { "[handleError] Ignoring socket error - already closed $error" }
logger.d { "[handleError] Ignoring socket error - already closed $receivedError" }
return
}

val error = receivedError.let {
// TODO Alex: This is a bad assumption, but necessary, needs to be checked against the backend
if (it is EOFException) {
ErrorResponse(
40,
"Unknown error trying to refresh token and reconnect.",
statusCode = 401,
)
} else {
it
}
}
val permanentError = isPermanentError(error)
if (permanentError) {
logger.e { "[handleError] Permanent error: $error" }
Expand Down

0 comments on commit 9005fa2

Please sign in to comment.