Skip to content

Commit 380529f

Browse files
committed
add logs
1 parent a1e3f2c commit 380529f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/main/kotlin/tech/relaycorp/poweb/PoWebClient.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -314,6 +314,7 @@ public class PoWebClient internal constructor(
314314
headers?.forEach { header(it.first, it.second) }
315315
}
316316
repeat(Int.MAX_VALUE) {
317+
logger.info { "Starting WebSocket connection attempt #$it" }
317318
try {
318319
return ktorClient.webSocket(url, request, block)
319320
} catch (exc: EOFException) {
@@ -322,7 +323,10 @@ public class PoWebClient internal constructor(
322323
logger.info { "WebSocket connection ended abruptly (${exc.message}). Will retry." }
323324
delay(ABRUPT_DISCONNECT_RETRY_DELAY)
324325
} catch (exc: IOException) {
326+
logger.info { "Server is unreachable (${exc.message})" }
325327
throw ServerConnectionException("Server is unreachable", exc)
328+
} finally {
329+
logger.info { "WebSocket connection attempt #$it ended" }
326330
}
327331
}
328332
}

0 commit comments

Comments
 (0)