Skip to content

Commit

Permalink
Added Socket check
Browse files Browse the repository at this point in the history
  • Loading branch information
flyfishxu committed Nov 5, 2024
1 parent 59315f8 commit 307cbed
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions kadb/src/commonMain/kotlin/Kadb.kt
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ class Kadb private constructor(

private var connection: Pair<AdbConnection, Socket>? = null

fun connectionCheck(): Boolean {
return connection?.second?.isConnected ?: false
}

fun open(destination: String): AdbStream {
val conn = connection ?: newConnection().also { connection = it }
return conn.first.open(destination)
Expand Down

0 comments on commit 307cbed

Please sign in to comment.