Merge pull request #3001 from NetworkKeeper/patch-2
Retry downloading geo assets without proxy
This commit is contained in:
1 file changed
+14
-7
@@ -177,7 +177,10 @@ class UserAssetActivity : BaseActivity() {
|
|||||||
assets.forEach {
|
assets.forEach {
|
||||||
//toast(getString(R.string.msg_downloading_content) + it)
|
//toast(getString(R.string.msg_downloading_content) + it)
|
||||||
lifecycleScope.launch(Dispatchers.IO) {
|
lifecycleScope.launch(Dispatchers.IO) {
|
||||||
val result = downloadGeo(it.second, 60000, httpPort)
|
var result = downloadGeo(it.second, 60000, httpPort)
|
||||||
|
if (!result) {
|
||||||
|
result = downloadGeo(it.second, 60000, 0)
|
||||||
|
}
|
||||||
launch(Dispatchers.Main) {
|
launch(Dispatchers.Main) {
|
||||||
if (result) {
|
if (result) {
|
||||||
toast(getString(R.string.toast_success) + " " + it.second.remarks)
|
toast(getString(R.string.toast_success) + " " + it.second.remarks)
|
||||||
@@ -197,12 +200,16 @@ class UserAssetActivity : BaseActivity() {
|
|||||||
//Log.d(AppConfig.ANG_PACKAGE, url)
|
//Log.d(AppConfig.ANG_PACKAGE, url)
|
||||||
|
|
||||||
try {
|
try {
|
||||||
conn = URL(item.url).openConnection(
|
conn = if (httpPort == 0) {
|
||||||
Proxy(
|
URL(item.url).openConnection() as HttpURLConnection
|
||||||
Proxy.Type.HTTP,
|
} else {
|
||||||
InetSocketAddress("127.0.0.1", httpPort)
|
URL(item.url).openConnection(
|
||||||
)
|
Proxy(
|
||||||
) as HttpURLConnection
|
Proxy.Type.HTTP,
|
||||||
|
InetSocketAddress("127.0.0.1", httpPort)
|
||||||
|
)
|
||||||
|
) as HttpURLConnection
|
||||||
|
}
|
||||||
conn.connectTimeout = timeout
|
conn.connectTimeout = timeout
|
||||||
conn.readTimeout = timeout
|
conn.readTimeout = timeout
|
||||||
val inputStream = conn.inputStream
|
val inputStream = conn.inputStream
|
||||||
|
|||||||
Reference in new issue
Block a user