Make limits into a pkg.
This is so that we can use the in other utils. debated with davec
This commit is contained in:
parent
dd7c910e86
commit
d00ccc0d3c
5 changed files with 15 additions and 7 deletions
3
btcd.go
3
btcd.go
|
@ -5,6 +5,7 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"github.com/conformal/btcd/limits"
|
||||
"fmt"
|
||||
"net"
|
||||
"net/http"
|
||||
|
@ -128,7 +129,7 @@ func main() {
|
|||
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||
|
||||
// Up some limits.
|
||||
if err := setLimits(); err != nil {
|
||||
if err := limits.SetLimits(); err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@
|
|||
// Use of this source code is governed by an ISC
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
package limits
|
||||
|
||||
// Plan 9 has no process accounting. no-op here
|
||||
func setLimits() error {
|
||||
func SetLimits() error {
|
||||
return nil
|
||||
}
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
// +build !windows,!plan9
|
||||
|
||||
package main
|
||||
package limits
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
@ -16,7 +16,7 @@ const (
|
|||
fileLimitMin = 1024
|
||||
)
|
||||
|
||||
func setLimits() error {
|
||||
func SetLimits() error {
|
||||
var rLimit syscall.Rlimit
|
||||
|
||||
err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit)
|
|
@ -2,8 +2,8 @@
|
|||
// Use of this source code is governed by an ISC
|
||||
// license that can be found in the LICENSE file.
|
||||
|
||||
package main
|
||||
package limits
|
||||
|
||||
func setLimits() error {
|
||||
func SetLimits() error {
|
||||
return nil
|
||||
}
|
|
@ -7,6 +7,7 @@ package main
|
|||
import (
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"github.com/conformal/btcd/limits"
|
||||
"github.com/conformal/btcdb"
|
||||
_ "github.com/conformal/btcdb/ldb"
|
||||
"github.com/conformal/btclog"
|
||||
|
@ -66,8 +67,14 @@ func main() {
|
|||
return
|
||||
}
|
||||
|
||||
// Use all processor cores.
|
||||
runtime.GOMAXPROCS(runtime.NumCPU())
|
||||
|
||||
// Up some limits.
|
||||
if err := limits.SetLimits(); err != nil {
|
||||
os.Exit(1)
|
||||
}
|
||||
|
||||
backendLogger := btclog.NewDefaultBackendLogger()
|
||||
defer backendLogger.Flush()
|
||||
log = btclog.NewSubsystemLogger(backendLogger, "")
|
||||
|
|
Loading…
Reference in a new issue