Skip to content

Commit

Permalink
fixup! fixup! KTOR-1159 Add support for UDP sockets on native
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas-Vos committed Nov 15, 2020
1 parent a09e961 commit b0d48b7
Showing 1 changed file with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ internal class DatagramSendChannel(

@ExperimentalCoroutinesApi
override val isFull: Boolean
get() = if (isClosedForSend) false else lock.isLocked
get() = if (isClosedForSend) false else lock.availablePermits == 0

private val lock = Mutex()
private val lock = Semaphore(1)

override fun close(cause: Throwable?): Boolean {
// if (socket.isClosed) {
Expand All @@ -44,7 +44,7 @@ internal class DatagramSendChannel(
}

override suspend fun send(element: Datagram) {
lock.withLock {
lock.withPermit {
sendImpl(element)
}
}
Expand Down

0 comments on commit b0d48b7

Please sign in to comment.