File tree Expand file tree Collapse file tree 1 file changed +20
-18
lines changed
app/src/main/java/tech/httptoolkit/android Expand file tree Collapse file tree 1 file changed +20
-18
lines changed Original file line number Diff line number Diff line change @@ -10,6 +10,7 @@ import tech.httptoolkit.android.vpn.socket.SocketNIODataService
1010import io.sentry.Sentry
1111import java.io.FileInputStream
1212import java.io.FileOutputStream
13+ import java.io.InterruptedIOException
1314import java.net.InetSocketAddress
1415import java.nio.ByteBuffer
1516
@@ -68,26 +69,27 @@ class ProxyVpnRunnable(
6869
6970 running = true
7071 while (running) {
71- data = packet.array()
72-
73- length = vpnReadStream.read(data)
74- if ( length > 0 ) {
75- try {
76- packet.limit(length)
77- handler.handlePacket(packet )
78- } catch (e : Exception ) {
79- Sentry .capture(e)
80- Log .e( TAG , e.message )
81- }
82-
83- packet.clear()
84- } else {
85- try {
72+ try {
73+ data = packet.array()
74+
75+ length = vpnReadStream.read(data)
76+ if (length > 0 ) {
77+ try {
78+ packet.limit(length )
79+ handler.handlePacket(packet)
80+ } catch (e : Exception ) {
81+ Sentry .capture(e )
82+ Log .e( TAG , e.message)
83+ }
84+
85+ packet.clear()
86+ } else {
8687 Thread .sleep(10 )
87- } catch (e: InterruptedException ) {
88- Log .d(TAG , " Failed to sleep: " + e.message)
8988 }
90-
89+ } catch (e: InterruptedException ) {
90+ Log .i(TAG , " Sleep interrupted: " + e.message)
91+ } catch (e: InterruptedIOException ) {
92+ Log .i(TAG , " Read interrupted: " + e.message)
9193 }
9294 }
9395
You can’t perform that action at this time.
0 commit comments