Skip to content

Commit

Permalink
Merge pull request #1558 from mlaventure/dialer-quick-fix
Browse files Browse the repository at this point in the history
Move unix specific tidbits into dialer_unix.go
  • Loading branch information
estesp committed Sep 25, 2017
2 parents 357eff8 + c42f56b commit 1a9d939
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 1 addition & 3 deletions dialer.go
Expand Up @@ -2,7 +2,6 @@ package containerd

import (
"net"
"strings"
"time"

"github.com/pkg/errors"
Expand All @@ -18,7 +17,6 @@ func Dialer(address string, timeout time.Duration) (net.Conn, error) {
stopC = make(chan struct{})
synC = make(chan *dialResult)
)
address = strings.TrimPrefix(address, "unix://")
go func() {
defer close(synC)
for {
Expand Down Expand Up @@ -47,6 +45,6 @@ func Dialer(address string, timeout time.Duration) (net.Conn, error) {
dr.c.Close()
}
}()
return nil, errors.Errorf("dial %s: no such file or directory", address)
return nil, errors.Errorf("dial %s: timeout", address)
}
}
2 changes: 2 additions & 0 deletions dialer_unix.go
Expand Up @@ -6,6 +6,7 @@ import (
"fmt"
"net"
"os"
"strings"
"syscall"
"time"
)
Expand All @@ -24,6 +25,7 @@ func isNoent(err error) bool {
}

func dialer(address string, timeout time.Duration) (net.Conn, error) {
address = strings.TrimPrefix(address, "unix://")
return net.DialTimeout("unix", address, timeout)
}

Expand Down

0 comments on commit 1a9d939

Please sign in to comment.