Skip to content

Commit

Permalink
Transport dialer: setting nil for wasm build (#21451)
Browse files Browse the repository at this point in the history
* Transport dialer: setting nil for wasm build

* license
  • Loading branch information
magodo authored and jhendrixMSFT committed Sep 6, 2023
1 parent b1db0be commit 0414a4b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 2 deletions.
15 changes: 15 additions & 0 deletions sdk/azcore/runtime/transport_default_dialer_other.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//go:build !wasm

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package runtime

import (
"context"
"net"
)

func defaultTransportDialContext(dialer *net.Dialer) func(context.Context, string, string) (net.Conn, error) {
return dialer.DialContext
}
15 changes: 15 additions & 0 deletions sdk/azcore/runtime/transport_default_dialer_wasm.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//go:build (js && wasm) || wasip1

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.

package runtime

import (
"context"
"net"
)

func defaultTransportDialContext(dialer *net.Dialer) func(context.Context, string, string) (net.Conn, error) {
return nil
}
4 changes: 2 additions & 2 deletions sdk/azcore/runtime/transport_default_http_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ var defaultHTTPClient *http.Client
func init() {
defaultTransport := &http.Transport{
Proxy: http.ProxyFromEnvironment,
DialContext: (&net.Dialer{
DialContext: defaultTransportDialContext(&net.Dialer{
Timeout: 30 * time.Second,
KeepAlive: 30 * time.Second,
}).DialContext,
}),
ForceAttemptHTTP2: true,
MaxIdleConns: 100,
IdleConnTimeout: 90 * time.Second,
Expand Down

0 comments on commit 0414a4b

Please sign in to comment.