Commit f870093c authored by Max Lv's avatar Max Lv

Fix EBADF error with proguard

parent f4e5a958
...@@ -23,6 +23,8 @@ ...@@ -23,6 +23,8 @@
-keepattributes *DatabaseField* -keepattributes *DatabaseField*
-keepattributes *DatabaseTable* -keepattributes *DatabaseTable*
-keepattributes *SerializedName* -keepattributes *SerializedName*
-keepattributes Exceptions, InnerClasses
-keep class com.j256.** -keep class com.j256.**
-keepclassmembers class com.j256.** { *; } -keepclassmembers class com.j256.** { *; }
-keep enum com.j256.** -keep enum com.j256.**
......
...@@ -54,17 +54,27 @@ abstract class LocalSocketListener(private val tag: String) : Thread() { ...@@ -54,17 +54,27 @@ abstract class LocalSocketListener(private val tag: String) : Thread() {
while (true) { while (true) {
val serverSocket = serverSocket.get() ?: return val serverSocket = serverSocket.get() ?: return
try { try {
val socket = serverSocket.accept()
try { try {
serverSocket.accept() accept(socket)
} catch (e: IOException) {
Log.e(tag, "Error when accept socket", e)
app.track(e)
null
}?.use(this::accept)
} catch (e: Exception) { } catch (e: Exception) {
Log.e(tag, "Error when recv traffic stat", e) Log.e(tag, "Error when recv traffic stat", e)
app.track(e) app.track(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
}
} }
} }
......
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