Source File
	rlimit_unix.go
Belonging Package
	net
// Copyright 2023 The Go Authors. All rights reserved.// Use of this source code is governed by a BSD-style// license that can be found in the LICENSE file.//go:build unix || wasip1package netimport// concurrentThreadsLimit returns the number of threads we permit to// run concurrently doing DNS lookups via cgo. A DNS lookup may use a// file descriptor so we limit this to less than the number of// permitted open files. On some systems, notably Darwin, if// getaddrinfo is unable to open a file descriptor it simply returns// EAI_NONAME rather than a useful error. Limiting the number of// concurrent getaddrinfo calls to less than the permitted number of// file descriptors makes that error less likely. We don't bother to// apply the same limit to DNS lookups run directly from Go, because// there we will return a meaningful "too many open files" error.func () int {var syscall.Rlimitif := syscall.Getrlimit(syscall.RLIMIT_NOFILE, &); != nil {return 500}:= .Curif > 500 {= 500} else if > 30 {-= 30}return int()}
|  | The pages are generated with Golds v0.7.6. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |