1
0
Fork 0
mirror of https://github.com/owncast/owncast.git synced 2024-12-23 01:31:10 +03:00
owncast/core/chat/concurrentConnections_freebsd.go

25 lines
529 B
Go
Raw Normal View History

// +build freebsd
package chat
import (
"syscall"
log "github.com/sirupsen/logrus"
)
func setSystemConcurrentConnectionLimit(limit int64) {
var rLimit syscall.Rlimit
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit); err != nil {
log.Fatalln(err)
}
originalLimit := rLimit.Cur
rLimit.Cur = int64(limit)
if err := syscall.Setrlimit(syscall.RLIMIT_NOFILE, &rLimit); err != nil {
log.Fatalln(err)
}
log.Traceln("Max process connection count changed from system limit of", originalLimit, "to", limit)
}