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
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//go:build !windows && !linux && !wasm
|
||||
//go:build !windows && !linux && !wasm && !plan9
|
||||
|
||||
/* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
|
|
|||
14
conn/erraddrinuse.go
Normal file
14
conn/erraddrinuse.go
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
//go:build !plan9
|
||||
|
||||
/* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Copyright (C) 2017-2023 WireGuard LLC. All Rights Reserved.
|
||||
*/
|
||||
|
||||
package conn
|
||||
|
||||
import "syscall"
|
||||
|
||||
func init() {
|
||||
errEADDRINUSE = syscall.EADDRINUSE
|
||||
}
|
||||
|
|
@ -1,3 +1,5 @@
|
|||
//go:build wasm || plan9
|
||||
|
||||
/* SPDX-License-Identifier: MIT
|
||||
*
|
||||
* Copyright (C) 2017-2023 WireGuard LLC. All Rights Reserved.
|
||||
|
|
@ -5,7 +7,7 @@
|
|||
|
||||
package ipc
|
||||
|
||||
// Made up sentinel error codes for {js,wasip1}/wasm.
|
||||
// Made up sentinel error codes for {js,wasip1}/wasm, and plan9.
|
||||
const (
|
||||
IpcErrorIO = 1
|
||||
IpcErrorInvalid = 2
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
//go:build !windows && !wasm
|
||||
//go:build !windows && !wasm && !plan9
|
||||
|
||||
/* SPDX-License-Identifier: MIT
|
||||
*
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
//go:build windows || wasm
|
||||
//go:build windows || wasm || plan9
|
||||
|
||||
// SPDX-License-Identifier: MIT
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue