Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
com.ccwangluo.accelerator
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sheteng
com.ccwangluo.accelerator
Commits
44c5180d
Commit
44c5180d
authored
Feb 12, 2019
by
Mygod
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Refine EOF exception
parent
5905625f
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
1 deletion
+4
-1
core/src/main/java/com/github/shadowsocks/net/LocalDnsServer.kt
...rc/main/java/com/github/shadowsocks/net/LocalDnsServer.kt
+2
-0
core/src/main/java/com/github/shadowsocks/net/Socks5Endpoint.kt
...rc/main/java/com/github/shadowsocks/net/Socks5Endpoint.kt
+2
-1
No files found.
core/src/main/java/com/github/shadowsocks/net/LocalDnsServer.kt
View file @
44c5180d
...
@@ -25,6 +25,7 @@ import com.crashlytics.android.Crashlytics
...
@@ -25,6 +25,7 @@ import com.crashlytics.android.Crashlytics
import
com.github.shadowsocks.utils.printLog
import
com.github.shadowsocks.utils.printLog
import
kotlinx.coroutines.*
import
kotlinx.coroutines.*
import
org.xbill.DNS.*
import
org.xbill.DNS.*
import
java.io.EOFException
import
java.io.IOException
import
java.io.IOException
import
java.net.*
import
java.net.*
import
java.nio.ByteBuffer
import
java.nio.ByteBuffer
...
@@ -131,6 +132,7 @@ class LocalDnsServer(private val localResolver: suspend (String) -> Array<InetAd
...
@@ -131,6 +132,7 @@ class LocalDnsServer(private val localResolver: suspend (String) -> Array<InetAd
when
(
e
)
{
when
(
e
)
{
is
TimeoutCancellationException
->
Crashlytics
.
log
(
Log
.
WARN
,
TAG
,
"Remote resolving timed out"
)
is
TimeoutCancellationException
->
Crashlytics
.
log
(
Log
.
WARN
,
TAG
,
"Remote resolving timed out"
)
is
CancellationException
->
{
}
// ignore
is
CancellationException
->
{
}
// ignore
is
EOFException
->
Crashlytics
.
log
(
Log
.
WARN
,
TAG
,
e
.
message
)
else
->
printLog
(
e
)
else
->
printLog
(
e
)
}
}
ByteBuffer
.
wrap
(
prepareDnsResponse
(
request
).
apply
{
ByteBuffer
.
wrap
(
prepareDnsResponse
(
request
).
apply
{
...
...
core/src/main/java/com/github/shadowsocks/net/Socks5Endpoint.kt
View file @
44c5180d
...
@@ -23,6 +23,7 @@ package com.github.shadowsocks.net
...
@@ -23,6 +23,7 @@ package com.github.shadowsocks.net
import
com.github.shadowsocks.utils.parseNumericAddress
import
com.github.shadowsocks.utils.parseNumericAddress
import
net.sourceforge.jsocks.Socks4Message
import
net.sourceforge.jsocks.Socks4Message
import
net.sourceforge.jsocks.Socks5Message
import
net.sourceforge.jsocks.Socks5Message
import
java.io.EOFException
import
java.io.IOException
import
java.io.IOException
import
java.net.Inet4Address
import
java.net.Inet4Address
import
java.net.Inet6Address
import
java.net.Inet6Address
...
@@ -69,7 +70,7 @@ class Socks5Endpoint(host: String, port: Int) {
...
@@ -69,7 +70,7 @@ class Socks5Endpoint(host: String, port: Int) {
suspend
fun
readBytes
(
till
:
Int
)
{
suspend
fun
readBytes
(
till
:
Int
)
{
if
(
buffer
.
position
()
>=
till
)
return
if
(
buffer
.
position
()
>=
till
)
return
while
(
reader
(
buffer
)
>=
0
&&
buffer
.
position
()
<
till
)
wait
()
while
(
reader
(
buffer
)
>=
0
&&
buffer
.
position
()
<
till
)
wait
()
if
(
buffer
.
position
()
<
till
)
throw
IOException
(
"EOF
"
)
if
(
buffer
.
position
()
<
till
)
throw
EOFException
(
"${buffer.position()} < $till
"
)
}
}
suspend
fun
read
(
index
:
Int
):
Byte
{
suspend
fun
read
(
index
:
Int
):
Byte
{
readBytes
(
index
+
1
)
readBytes
(
index
+
1
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment