Move unix specific tidbits into dialer_unix.go
Signed-off-by: Kenfe-Mickael Laventure <mickael.laventure@gmail.com>
This commit is contained in:
parent
20c621178a
commit
c42f56b3a1
@ -2,7 +2,6 @@ package containerd
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"net"
|
"net"
|
||||||
"strings"
|
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pkg/errors"
|
"github.com/pkg/errors"
|
||||||
@ -18,7 +17,6 @@ func Dialer(address string, timeout time.Duration) (net.Conn, error) {
|
|||||||
stopC = make(chan struct{})
|
stopC = make(chan struct{})
|
||||||
synC = make(chan *dialResult)
|
synC = make(chan *dialResult)
|
||||||
)
|
)
|
||||||
address = strings.TrimPrefix(address, "unix://")
|
|
||||||
go func() {
|
go func() {
|
||||||
defer close(synC)
|
defer close(synC)
|
||||||
for {
|
for {
|
||||||
@ -47,6 +45,6 @@ func Dialer(address string, timeout time.Duration) (net.Conn, error) {
|
|||||||
dr.c.Close()
|
dr.c.Close()
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
return nil, errors.Errorf("dial %s: no such file or directory", address)
|
return nil, errors.Errorf("dial %s: timeout", address)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,6 +6,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net"
|
"net"
|
||||||
"os"
|
"os"
|
||||||
|
"strings"
|
||||||
"syscall"
|
"syscall"
|
||||||
"time"
|
"time"
|
||||||
)
|
)
|
||||||
@ -24,6 +25,7 @@ func isNoent(err error) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func dialer(address string, timeout time.Duration) (net.Conn, error) {
|
func dialer(address string, timeout time.Duration) (net.Conn, error) {
|
||||||
|
address = strings.TrimPrefix(address, "unix://")
|
||||||
return net.DialTimeout("unix", address, timeout)
|
return net.DialTimeout("unix", address, timeout)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user