Commit cecfbb03 authored by Mygod's avatar Mygod

Use rethrowAsSocketException

parent f63cb2e5
......@@ -96,7 +96,7 @@ sealed class DnsResolverCompat {
val err = bindSocketToNetwork.invoke(null, socket.int, netId) as Int
if (err == 0) return
val message = "Binding socket to network $netId"
throw IOException(message, ErrnoException(message, -err))
throw ErrnoException(message, -err).rethrowAsSocketException()
}
override suspend fun connectUdp(fd: FileDescriptor, address: InetAddress, port: Int) {
......
......@@ -71,7 +71,7 @@ abstract class LocalSocketListener(name: String, socketFile: File) : Thread(name
Os.shutdown(this, OsConstants.SHUT_RDWR)
} catch (e: ErrnoException) {
// suppress fd inactive or already closed
if (e.errno != OsConstants.EBADF && e.errno != OsConstants.ENOTCONN) throw IOException(e)
if (e.errno != OsConstants.EBADF && e.errno != OsConstants.ENOTCONN) throw e.rethrowAsSocketException()
}
}
scope.launch { closeChannel.receive() }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment