fixed fatal linux error with listenaddr incorrectly duplicated

This commit is contained in:
2019-03-22 16:22:48 -04:00
parent 496e255884
commit 5b262e6651
2 changed files with 6 additions and 9 deletions

View File

@@ -1,7 +1,7 @@
[serverConfig] [serverConfig]
ServerPort = "8000" #leave format as is it expects a string with colon ServerPort = "8000" #Required to input as string
ServerAddr = "192.168.1.8" #Put in the IP address you want to bind to ServerAddr = "192.168.1.8" #Put in the IP address you want to bind to as string
LogLevel = "Debug" # Options = Debug, Info, Warn, Error, Fatal, Panic LogLevel = "Debug" # Options = Debug, Info, Warn, Error, Fatal, Panic
LogOutput = "file" #Options = file, stdout #file will print it to logs/server.log LogOutput = "file" #Options = file, stdout #file will print it to logs/server.log

View File

@@ -217,12 +217,12 @@ func FullClientSettingsNew() FullClientSettings {
// fmt.Println("Reading in custom DHT config") // fmt.Println("Reading in custom DHT config")
// dhtServerConfig = dhtServerSettings(dhtServerConfig) // dhtServerConfig = dhtServerSettings(dhtServerConfig)
//} //}
strippedHTTPPort := strings.TrimPrefix(httpAddrPort, ":") strippedDHTPort := strings.TrimPrefix(listenAddr, ":")
httpAddrPortInt64, err := strconv.ParseInt(strippedHTTPPort, 10, 0) DHTPortInt64, err := strconv.ParseInt(strippedDHTPort, 10, 0)
if err != nil { if err != nil {
fmt.Println("Failed creating 64-bit integer for goTorrent Port!", err) fmt.Println("Failed creating 64-bit integer for goTorrent Port!", err)
} }
httpAddrPortInt := int(httpAddrPortInt64) //converting to integer DHTPortInt := int(DHTPortInt64) //converting to integer
encryptionPolicy := torrent.EncryptionPolicy{ encryptionPolicy := torrent.EncryptionPolicy{
DisableEncryption: viper.GetBool("EncryptionPolicy.DisableEncryption"), DisableEncryption: viper.GetBool("EncryptionPolicy.DisableEncryption"),
@@ -233,7 +233,7 @@ func FullClientSettingsNew() FullClientSettings {
tConfig := torrent.NewDefaultClientConfig() tConfig := torrent.NewDefaultClientConfig()
tConfig.DataDir = dataDirAbs tConfig.DataDir = dataDirAbs
tConfig.ListenPort = httpAddrPortInt tConfig.ListenPort = DHTPortInt
tConfig.DisablePEX = disablePex tConfig.DisablePEX = disablePex
tConfig.NoDHT = noDHT tConfig.NoDHT = noDHT
tConfig.NoUpload = noUpload tConfig.NoUpload = noUpload
@@ -246,9 +246,6 @@ func FullClientSettingsNew() FullClientSettings {
tConfig.DisableIPv6 = disableIPv6 tConfig.DisableIPv6 = disableIPv6
tConfig.Debug = debug tConfig.Debug = debug
tConfig.EncryptionPolicy = encryptionPolicy tConfig.EncryptionPolicy = encryptionPolicy
if listenAddr != "" {
tConfig.SetListenAddr(listenAddr) //Setting the IP address to listen on
}
Config := FullClientSettings{ Config := FullClientSettings{
LoggingLevel: logLevel, LoggingLevel: logLevel,