mirror of
https://git.sr.ht/~emersion/tlstunnel
synced 2024-11-19 15:53:50 +01:00
Remove file limit bump
Starting with Go 1.19 [0] the file limit is increased by default.
[0]: 8427429c59
This commit is contained in:
parent
109d44b113
commit
c888547e5b
@ -51,27 +51,11 @@ func newServer() (*tlstunnel.Server, error) {
|
||||
return srv, nil
|
||||
}
|
||||
|
||||
func bumpOpenedFileLimit() error {
|
||||
var rlimit syscall.Rlimit
|
||||
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rlimit); err != nil {
|
||||
return fmt.Errorf("failed to get RLIMIT_NOFILE: %v", err)
|
||||
}
|
||||
rlimit.Cur = rlimit.Max
|
||||
if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rlimit); err != nil {
|
||||
return fmt.Errorf("failed to set RLIMIT_NOFILE: %v", err)
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
flag.StringVar(&configPath, "config", configPath, "path to configuration file")
|
||||
flag.BoolVar(&debug, "debug", false, "enable debug logging")
|
||||
flag.Parse()
|
||||
|
||||
if err := bumpOpenedFileLimit(); err != nil {
|
||||
log.Printf("failed to bump max number of opened files: %v", err)
|
||||
}
|
||||
|
||||
srv, err := newServer()
|
||||
if err != nil {
|
||||
log.Fatalf("failed to create server: %v", err)
|
||||
|
Loading…
Reference in New Issue
Block a user