Source File
reuseport_posix.go
Belonging Package
github.com/libp2p/go-libp2p/p2p/net/reuseport
//go:build !plan9package reuseportimport ()// reuseErrShouldRetry diagnoses whether to retry after a reuse error.// if we failed to bind, we should retry. if bind worked and this is a// real dial error (remote end didnt answer) then we should not retry.func reuseErrShouldRetry( error) bool {if == nil {return false // hey, it worked! no need to retry.}// if it's a network timeout error, it's a legitimate failure.if , := .(net.Error); && .Timeout() {return false}, := .(syscall.Errno)if ! { // not an errno? who knows what this is. retry.return true}switch {case syscall.EADDRINUSE, syscall.EADDRNOTAVAIL:return true // failure to bind. retry.case syscall.ECONNREFUSED:return false // real dial errordefault:return true // optimistically default to retry.}}
![]() |
The pages are generated with Golds v0.8.2. (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. |