Skip to content
This repository was archived by the owner on Jun 15, 2023. It is now read-only.

Commit 753a34d

Browse files
committed
auto mmap for downloads
1 parent bf6c547 commit 753a34d

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

engine/config.go

-2
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ type Config struct {
3535
DisableIPv6 bool
3636
NoDefaultPortForwarding bool
3737
DisableUTP bool
38-
UseMmap bool
3938
DownloadDirectory string
4039
WatchDirectory string
4140
EnableUpload bool
@@ -69,7 +68,6 @@ func InitConf(specPath string) (*Config, error) {
6968
viper.SetDefault("EnableSeeding", true)
7069
viper.SetDefault("NoDefaultPortForwarding", true)
7170
viper.SetDefault("DisableUTP", false)
72-
viper.SetDefault("UseMmap", false)
7371
viper.SetDefault("AutoStart", true)
7472
viper.SetDefault("DoneCmd", "")
7573
viper.SetDefault("SeedRatio", 0)

engine/engine.go

+5-1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"net/http"
88
"net/url"
99
"path"
10+
"strconv"
1011
"sync"
1112
"time"
1213

@@ -86,7 +87,10 @@ func (e *Engine) Configure(c *Config) error {
8687
tc.DisableUTP = c.DisableUTP
8788
tc.ListenPort = c.IncomingPort
8889
tc.DataDir = c.DownloadDirectory
89-
if c.UseMmap {
90+
91+
// enable MMap on 64bit machines
92+
if strconv.IntSize == 64 {
93+
log.Println("[Configure] 64bit arch detected, using MMap for storage")
9094
tc.DefaultStorage = storage.NewMMap(tc.DataDir)
9195
}
9296
if c.MuteEngineLog {

0 commit comments

Comments
 (0)