Skip to content

Commit

Permalink
Revert "Replace deprecated Transport.Dial with Transport.DialContext"
Browse files Browse the repository at this point in the history
This reverts commit 61039d0.

Signed-off-by: Sebastiaan van Stijn <[email protected]>
  • Loading branch information
thaJeztah committed Jul 26, 2021
1 parent 62021ac commit c0d1e8f
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 15 deletions.
2 changes: 1 addition & 1 deletion sockets/sockets.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ func ConfigureTransport(tr *http.Transport, proto, addr string) error {
if err != nil {
return err
}
tr.DialContext = dialer.DialContext
tr.Dial = dialer.Dial
}
return nil
}
7 changes: 2 additions & 5 deletions sockets/sockets_unix.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,8 @@ func configureUnixTransport(tr *http.Transport, proto, addr string) error {
}
// No need for compression in local communications.
tr.DisableCompression = true
dialer := &net.Dialer{
Timeout: defaultTimeout,
}
tr.DialContext = func(ctx context.Context, _, _ string) (net.Conn, error) {
return dialer.DialContext(ctx, proto, addr)
tr.Dial = func(_, _ string) (net.Conn, error) {
return net.DialTimeout(proto, addr, defaultTimeout)
}
return nil
}
Expand Down
10 changes: 1 addition & 9 deletions sockets/sockets_windows.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,7 @@ func configureUnixTransport(tr *http.Transport, proto, addr string) error {
func configureNpipeTransport(tr *http.Transport, proto, addr string) error {
// No need for compression in local communications.
tr.DisableCompression = true
dialer := &net.Dialer{
Timeout: defaultTimeout,
}
tr.DialContext = func(ctx context.Context, _, _ string) (net.Conn, error) {
// 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)
tr.Dial = func(_, _ string) (net.Conn, error) {
return DialPipe(addr, defaultTimeout)
}
return nil
Expand Down

0 comments on commit c0d1e8f

Please sign in to comment.