Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

revert "configureNpipeTransport: use winio.DialPipeContext()" #91

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from
Draft
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
3 changes: 3 additions & 0 deletions sockets/sockets.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,11 @@ package sockets
import (
"errors"
"net/http"
"time"
)

const defaultTimeout = 10 * time.Second

// ErrProtocolNotAvailable is returned when a given transport protocol is not provided by the operating system.
var ErrProtocolNotAvailable = errors.New("protocol not available")

Expand Down
5 changes: 1 addition & 4 deletions sockets/sockets_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@ import (
"time"
)

const (
defaultTimeout = 10 * time.Second
maxUnixSocketPathSize = len(syscall.RawSockaddrUnix{}.Path)
)
const maxUnixSocketPathSize = len(syscall.RawSockaddrUnix{}.Path)

func configureUnixTransport(tr *http.Transport, proto, addr string) error {
if len(addr) > maxUnixSocketPathSize {
Expand Down
7 changes: 6 additions & 1 deletion sockets/sockets_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@ func configureNpipeTransport(tr *http.Transport, proto, addr string) error {
// No need for compression in local communications.
tr.DisableCompression = true
tr.DialContext = func(ctx context.Context, _, _ string) (net.Conn, error) {
return winio.DialPipeContext(ctx, addr)
// DialPipeContext() has been added to winio:
// https://github.com/Microsoft/go-winio/commit/5fdbdcc2ae1c7e1073157fa7cb34a15eab472e1d
// However, a new version of winio with this commit has not been released yet.
// Continue to use DialPipe() until DialPipeContext() becomes available.
//return winio.DialPipeContext(ctx, addr)
return DialPipe(addr, defaultTimeout)
}
return nil
}
Expand Down