cmd/utils: make fdlimit happy path a bit cleaner

This commit is contained in:
Péter Szilágyi 2019-02-12 11:52:00 +02:00 committed by GitHub
parent 79c6d99e0e
commit 5e7f3526eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -950,12 +950,11 @@ func makeDatabaseHandles() int {
if err != nil { if err != nil {
Fatalf("Failed to retrieve file descriptor allowance: %v", err) Fatalf("Failed to retrieve file descriptor allowance: %v", err)
} }
if u64limit, err := fdlimit.Raise(uint64(limit)); err != nil { raised, err := fdlimit.Raise(uint64(limit))
if err != nil {
Fatalf("Failed to raise file descriptor allowance: %v", err) Fatalf("Failed to raise file descriptor allowance: %v", err)
return 0 // Make the compiler happy
} else {
return int(u64limit / 2) // Leave half for networking and other stuff
} }
return int(raised / 2) // Leave half for networking and other stuff
} }
// MakeAddress converts an account specified directly as a hex encoded string or // MakeAddress converts an account specified directly as a hex encoded string or