20 lines
532 B
Kotlin
Raw Normal View History

2024-08-14 21:44:24 +02:00
package fr.acinq.lightning.vsock
import java.io.IOException
import java.net.SocketException
class ServerVSock : BaseVSock() {
@Throws(IOException::class)
fun accept(): VSock {
2024-08-16 04:27:21 +02:00
if (isClosed) {
throw SocketException("Socket closed")
}
2024-08-14 21:44:24 +02:00
if (!bound) throw SocketException("Socket not bound")
val socket = VSock()
socket.setImplementation()
socket.getImplementation()?.let { getImplementation()!!.accept(it) }
socket.postAccept()
return socket
}
}