We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a09e961 commit b0d48b7Copy full SHA for b0d48b7
ktor-network/posix/src/io/ktor/network/sockets/DatagramSendChannel.kt
@@ -25,9 +25,9 @@ internal class DatagramSendChannel(
25
26
@ExperimentalCoroutinesApi
27
override val isFull: Boolean
28
- get() = if (isClosedForSend) false else lock.isLocked
+ get() = if (isClosedForSend) false else lock.availablePermits == 0
29
30
- private val lock = Mutex()
+ private val lock = Semaphore(1)
31
32
override fun close(cause: Throwable?): Boolean {
33
// if (socket.isClosed) {
@@ -44,7 +44,7 @@ internal class DatagramSendChannel(
44
}
45
46
override suspend fun send(element: Datagram) {
47
- lock.withLock {
+ lock.withPermit {
48
sendImpl(element)
49
50
0 commit comments