You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
15 lines
380 B
15 lines
380 B
package chat |
|
|
|
import "syscall" |
|
|
|
func getMaximumConcurrentConnectionLimit() int64 { |
|
var rLimit syscall.Rlimit |
|
if err := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &rLimit); err != nil { |
|
panic(err) |
|
} |
|
|
|
// Return the limit to 70% of max so the machine doesn't die even if it's maxed out for some reason. |
|
proposedLimit := int64(float32(rLimit.Max) * 0.7) |
|
|
|
return proposedLimit |
|
}
|
|
|