Skip to content

A full-featured download manager.

refactor: engine config

Dr_rOotad1979417af8
diff --git a/src/main/core/ConfigManager.js b/src/main/core/ConfigManager.js
index 1b76adf8..19dd3796 100644
--- a/src/main/core/ConfigManager.js
+++ b/src/main/core/ConfigManager.js
@@ -10,11 +10,12 @@ import {
getMaxConnectionPerServer
} from '../utils/index'
import {
+ APP_RUN_MODE,
APP_THEME,
EMPTY_STRING,
- APP_RUN_MODE,
+ NGOSANG_TRACKERS_BEST_IP_URL,
NGOSANG_TRACKERS_BEST_URL,
- NGOSANG_TRACKERS_BEST_IP_URL
+ IP_VERSION
} from '@shared/constants'
import { separateConfig } from '@shared/utils'
@@ -46,12 +47,12 @@ export default class ConfigManager {
/* eslint-disable quote-props */
defaults: {
'all-proxy': EMPTY_STRING,
- 'allow-overwrite': true,
+ 'allow-overwrite': false,
'auto-file-renaming': true,
'bt-tracker': EMPTY_STRING,
'continue': true,
- 'dht-file-path': getDhtPath(4),
- 'dht-file-path6': getDhtPath(6),
+ 'dht-file-path': getDhtPath(IP_VERSION.V4),
+ 'dht-file-path6': getDhtPath(IP_VERSION.V6),
'dht-listen-port': 26701,
'dir': getUserDownloadsPath(),
'listen-port': 21301,
@@ -59,7 +60,7 @@ export default class ConfigManager {
'max-connection-per-server': getMaxConnectionPerServer(),
'max-download-limit': 0,
'max-overall-download-limit': 0,
- 'max-overall-upload-limit': '128K',
+ 'max-overall-upload-limit': '256K',
'min-split-size': '1M',
'no-proxy': EMPTY_STRING,
'pause': true,
diff --git a/src/main/utils/index.js b/src/main/utils/index.js
index 532f69c8..b321dcb8 100644
--- a/src/main/utils/index.js
+++ b/src/main/utils/index.js
@@ -4,8 +4,8 @@ import { resolve } from 'path'
import { existsSync, lstatSync } from 'fs'
import {
- MAX_CONNECTION_PER_SERVER_MAC,
- MAX_CONNECTION_PER_SERVER_OTHER
+ ENGINE_MAX_CONNECTION_PER_SERVER,
+ IP_VERSION
} from '@shared/constants'
import logger from '../core/Logger'
import engineBinMap from '../configs/engine'
@@ -15,7 +15,7 @@ export function getLogPath () {
}
export function getDhtPath (protocol) {
- const name = protocol === 6 ? 'dht6.dat' : 'dht.dat'
+ const name = protocol === IP_VERSION.V6 ? 'dht6.dat' : 'dht.dat'
return resolve(app.getPath('userData'), `./${name}`)
}
@@ -131,7 +131,5 @@ export function parseArgvAsFile (argv) {
}
export const getMaxConnectionPerServer = () => {
- return is.macOS()
- ? MAX_CONNECTION_PER_SERVER_MAC
- : MAX_CONNECTION_PER_SERVER_OTHER
+ return ENGINE_MAX_CONNECTION_PER_SERVER
}
diff --git a/src/renderer/components/Preference/Basic.vue b/src/renderer/components/Preference/Basic.vue
index 19a6d09c..1cc767f6 100644
--- a/src/renderer/components/Preference/Basic.vue
+++ b/src/renderer/components/Preference/Basic.vue
@@ -302,6 +302,10 @@
label: '128 KB/s',
value: '128K'
},
+ {
+ label: '256 KB/s',
+ value: '256K'
+ },
{
label: '512 KB/s',
value: '512K'
diff --git a/src/shared/constants.js b/src/shared/constants.js
index abfeae69..55f331b6 100644
--- a/src/shared/constants.js
+++ b/src/shared/constants.js
@@ -97,5 +97,9 @@ export const AUTO_CHECK_UPDATE_INTERVAL = 7 * 24 * 60 * 60 * 1000
export const NONE_SELECTED_FILES = 'none'
export const SELECTED_ALL_FILES = 'all'
-export const MAX_CONNECTION_PER_SERVER_MAC = 64
-export const MAX_CONNECTION_PER_SERVER_OTHER = 16
+export const ENGINE_MAX_CONNECTION_PER_SERVER = 64
+
+export const IP_VERSION = {
+ V4: 4,
+ V6: 6
+}