Fix EBADF error with proguard

This commit is contained in:
Max Lv
2017-12-05 23:16:29 -08:00
parent f4e5a958e0
commit f870093c94
2 changed files with 19 additions and 7 deletions
+2
View File
@@ -23,6 +23,8 @@
-keepattributes *DatabaseField*
-keepattributes *DatabaseTable*
-keepattributes *SerializedName*
-keepattributes Exceptions, InnerClasses
-keep class com.j256.**
-keepclassmembers class com.j256.** { *; }
-keep enum com.j256.**
@@ -54,16 +54,26 @@ abstract class LocalSocketListener(private val tag: String) : Thread() {
while (true) {
val serverSocket = serverSocket.get() ?: return
try {
val socket = serverSocket.accept()
try {
serverSocket.accept()
} catch (e: IOException) {
Log.e(tag, "Error when accept socket", e)
accept(socket)
} catch (e: Exception) {
Log.e(tag, "Error when recv traffic stat", e)
app.track(e)
null
}?.use(this::accept)
} catch (e: Exception) {
Log.e(tag, "Error when recv traffic stat", e)
}
try {
socket.close()
} catch (e: IOException) {
Log.e(tag, "Error when closing the local socket", e)
app.track(e)
}
} catch (e: IOException) {
Log.e(tag, "Error when accept socket", e)
app.track(e)
return
}
}
}