Workaround bug in AOSP code
Fix #2983, https://issuetracker.google.com/issues/36984866
This commit is contained in:
parent
2f02f9a580
commit
fc67c0195f
@ -68,8 +68,13 @@ abstract class SuRequestHandler(
|
||||
private suspend fun init(name: String) = withContext(Dispatchers.IO) {
|
||||
try {
|
||||
if (Const.Version.atLeastCanary()) {
|
||||
LocalServerSocket(name).use {
|
||||
socket = async { it.accept() }.timedAwait() ?: throw SocketError()
|
||||
val server = LocalServerSocket(name)
|
||||
// Do NOT use Closable?.use(block) here as LocalServerSocket does
|
||||
// not implement Closable on older Android platforms
|
||||
try {
|
||||
socket = async { server.accept() }.timedAwait() ?: throw SocketError()
|
||||
} finally {
|
||||
server.close()
|
||||
}
|
||||
} else {
|
||||
socket = LocalSocket()
|
||||
|
Loading…
Reference in New Issue
Block a user