Skip to content

Commit

Permalink
Increase delay for Windows hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
05nelsonm committed Apr 8, 2024
1 parent 67a801b commit bd5670a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,16 @@ private suspend fun IPAddress.isPortAvailable(port: Int): Boolean {
latch.cancel()
}

val waitTime = (if (IsUnixLikeHost) 42 else 84).milliseconds

while (
ctx.isActive
&& latch.isActive
&& isAvailable == null
&& error == null
) {
delay(1.milliseconds)
if (timeMark.elapsedNow() > 42.milliseconds) break
if (timeMark.elapsedNow() > waitTime) break
}
} finally {
latch.cancel()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,6 @@ public actual interface TorCtrl : Destroyable, TorEvent.Processor, TorCmd.Privil
fun callback(nread: Int, buf: dynamic) {
val jsBuf = Buffer.wrap(buf)
val readBuf = ReadBuffer.of(jsBuf)
// TODO: try/catch IllegalState?
feed.onData(readBuf, nread)
}

Expand Down Expand Up @@ -282,7 +281,7 @@ public actual interface TorCtrl : Destroyable, TorEvent.Processor, TorCmd.Privil
// A slight delay is needed before returning in order
// to ensure that the coroutine starts before able
// to call destroy on it.
delay(25.milliseconds)
delay(42.milliseconds)
} catch (t: Throwable) {
ctrl.destroy()
throw t
Expand Down

0 comments on commit bd5670a

Please sign in to comment.