all: adjust build tags for plan9
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
88b11b4a0d
commit
6cd5922a04
6 changed files with 26 additions and 5 deletions
|
|
@ -136,6 +136,11 @@ func listenNet(network string, port int) (*net.UDPConn, int, error) {
|
|||
return conn.(*net.UDPConn), uaddr.Port, nil
|
||||
}
|
||||
|
||||
// errEADDRINUSE is syscall.EADDRINUSE, boxed into an interface once
|
||||
// in erraddrinuse.go on almost all platforms. For other platforms,
|
||||
// it's at least non-nil.
|
||||
var errEADDRINUSE error = errors.New("")
|
||||
|
||||
func (s *StdNetBind) Open(uport uint16) ([]ReceiveFunc, uint16, error) {
|
||||
s.mu.Lock()
|
||||
defer s.mu.Unlock()
|
||||
|
|
@ -162,7 +167,7 @@ again:
|
|||
|
||||
// Listen on the same port as we're using for ipv4.
|
||||
v6conn, port, err = listenNet("udp6", port)
|
||||
if uport == 0 && errors.Is(err, syscall.EADDRINUSE) && tries < 100 {
|
||||
if uport == 0 && errors.Is(err, errEADDRINUSE) && tries < 100 {
|
||||
v4conn.Close()
|
||||
tries++
|
||||
goto again
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue