content: PrivilegedClient doesn't properly handle socket timeouts and connection errors
file: /server/PrivilegedClient.kt
code:
private suspend fun sendRaw(command: String): String? =
withTimeoutOrNull(TIMEOUT_MS) {
try {
Socket("127.0.0.1", PrivilegedServer.PORT).use { socket ->
socket.soTimeout = TIMEOUT_MS.toInt()
PrintWriter(socket.outputStream, true).println(command)
BufferedReader(InputStreamReader(socket.inputStream)).readLine()
}
} catch (_: Exception) {
null
}
}
description: The catch block swallows all exceptions. Different error types should be handled differently (e.g., connection refused vs timeout).
content: PrivilegedClient doesn't properly handle socket timeouts and connection errors
file: /server/PrivilegedClient.kt
code:
description: The catch block swallows all exceptions. Different error types should be handled differently (e.g., connection refused vs timeout).