Skip to content

Commit

Permalink
🐛 Fix telnet utils bug
Browse files Browse the repository at this point in the history
  • Loading branch information
guiyanakuang committed Feb 6, 2024
1 parent 7967605 commit 4545146
Showing 1 changed file with 4 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import com.clipevery.net.ClipClient
import io.github.oshai.kotlinlogging.KotlinLogging
import io.ktor.http.URLProtocol
import io.ktor.http.path
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.async
import kotlinx.coroutines.selects.select
import kotlinx.coroutines.withContext

class TelnetUtils(private val clipClient: ClipClient) {

Expand All @@ -17,11 +17,9 @@ class TelnetUtils(private val clipClient: ClipClient) {
if (hostInfoList.isEmpty()) {
return null
}
val deferredArray = withContext(ioDispatcher) {
hostInfoList.map { hostInfo ->
async {
if (telnet(hostInfo, port, timeout)) hostInfo else null
}
val deferredArray = hostInfoList.map { hostInfo ->
CoroutineScope(ioDispatcher).async {
if (telnet(hostInfo, port, timeout)) hostInfo else null
}
}

Expand Down

0 comments on commit 4545146

Please sign in to comment.