Browse Source

adjust default value of buffer size

pull/1435/head
Darien Raymond 6 years ago
parent
commit
c26a4b407b
No known key found for this signature in database
GPG Key ID: 7251FFA14BB18169
  1. 12
      features/policy/policy.go

12
features/policy/policy.go

@ -87,10 +87,12 @@ func init() {
defaultBufferSize = -1 // For pipe to use unlimited size defaultBufferSize = -1 // For pipe to use unlimited size
case defaultValue: // Env flag not defined. Use default values per CPU-arch. case defaultValue: // Env flag not defined. Use default values per CPU-arch.
switch runtime.GOARCH { switch runtime.GOARCH {
case "arm", "arm64", "mips", "mipsle", "mips64", "mips64le": case "arm", "mips", "mipsle":
defaultBufferSize = 16 * 1024 // 16k cache for low-end devices defaultBufferSize = 0
case "arm64", "mips64", "mips64le":
defaultBufferSize = 4 * 1024 // 4k cache for low-end devices
default: default:
defaultBufferSize = 2 * 1024 * 1024 defaultBufferSize = 512 * 1024
} }
default: default:
defaultBufferSize = int32(size) * 1024 * 1024 defaultBufferSize = int32(size) * 1024 * 1024
@ -109,8 +111,8 @@ func SessionDefault() Session {
Timeouts: Timeout{ Timeouts: Timeout{
Handshake: time.Second * 4, Handshake: time.Second * 4,
ConnectionIdle: time.Second * 300, ConnectionIdle: time.Second * 300,
UplinkOnly: time.Second * 2, UplinkOnly: time.Second * 1,
DownlinkOnly: time.Second * 5, DownlinkOnly: time.Second * 1,
}, },
Stats: Stats{ Stats: Stats{
UserUplink: false, UserUplink: false,

Loading…
Cancel
Save