Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions nfs/rpc/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,8 @@ import (
"io"
"math/rand"
"net"
"os"
"sync"
"sync/atomic"
"syscall"
"time"

"github.com/willscott/go-nfs-client/nfs/util"
Expand Down Expand Up @@ -58,15 +56,6 @@ type Client struct {
replies map[uint32]chan io.ReadSeeker
}

func isAddrInUse(err error) bool {
if er, ok := (err.(*net.OpError)); ok {
if syser, ok := er.Err.(*os.SyscallError); ok {
return syser.Err == syscall.EADDRINUSE
}
}
return false
}

func DialTCP(network string, addr string, privileged bool) (*Client, error) {
c := &Client{
network: network,
Expand Down
10 changes: 10 additions & 0 deletions nfs/rpc/client_plan9.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Copyright © 2017 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: BSD-2-Clause
package rpc

func isAddrInUse(err error) bool {
if err != nil && err.Error() == "address in use" {
return true
}
return false
}
20 changes: 20 additions & 0 deletions nfs/rpc/client_unix.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
//go:build darwin || dragonfly || freebsd || linux || nacl || netbsd || openbsd || solaris

// Copyright © 2017 VMware, Inc. All Rights Reserved.
// SPDX-License-Identifier: BSD-2-Clause
package rpc

import (
"net"
"os"
"syscall"
)

func isAddrInUse(err error) bool {
if er, ok := (err.(*net.OpError)); ok {
if syser, ok := er.Err.(*os.SyscallError); ok {
return syser.Err == syscall.EADDRINUSE
}
}
return false
}