WIP
Some checks failed
DCO action / DCO (pull_request) Failing after 1m29s
Tests and linters / Run gofumpt (pull_request) Successful in 1m26s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m13s
Vulncheck / Vulncheck (pull_request) Successful in 2m17s
Build / Build Components (pull_request) Successful in 2m41s
Tests and linters / gopls check (pull_request) Successful in 2m54s
Tests and linters / Staticcheck (pull_request) Successful in 3m3s
Tests and linters / Lint (pull_request) Successful in 3m42s
Tests and linters / Tests (pull_request) Successful in 4m31s
Tests and linters / Tests with -race (pull_request) Successful in 6m7s
Some checks failed
DCO action / DCO (pull_request) Failing after 1m29s
Tests and linters / Run gofumpt (pull_request) Successful in 1m26s
Pre-commit hooks / Pre-commit (pull_request) Successful in 2m13s
Vulncheck / Vulncheck (pull_request) Successful in 2m17s
Build / Build Components (pull_request) Successful in 2m41s
Tests and linters / gopls check (pull_request) Successful in 2m54s
Tests and linters / Staticcheck (pull_request) Successful in 3m3s
Tests and linters / Lint (pull_request) Successful in 3m42s
Tests and linters / Tests (pull_request) Successful in 4m31s
Tests and linters / Tests with -race (pull_request) Successful in 6m7s
This commit is contained in:
parent
b336a94294
commit
0d129151f2
4 changed files with 13 additions and 1 deletions
|
@ -780,6 +780,7 @@ func initShared(appCfg *config.Config, key *keys.PrivateKey, netState *networkSt
|
|||
Key: &key.PrivateKey,
|
||||
AllowExternal: apiclientconfig.AllowExternal(appCfg),
|
||||
ReconnectTimeout: apiclientconfig.ReconnectTimeout(appCfg),
|
||||
DialerSource: ds,
|
||||
}
|
||||
|
||||
return shared{
|
||||
|
|
|
@ -13,6 +13,10 @@ type Dialer interface {
|
|||
DialContext(ctx context.Context, network, address string) (net.Conn, error)
|
||||
}
|
||||
|
||||
func DialContextTCP(ctx context.Context, address string, d Dialer) (net.Conn, error) {
|
||||
return d.DialContext(ctx, "tcp", address)
|
||||
}
|
||||
|
||||
func newDefaulDialer(timeout time.Duration) net.Dialer {
|
||||
// From `grpc.WithContextDialer` comment:
|
||||
//
|
||||
|
@ -27,7 +31,7 @@ func newDefaulDialer(timeout time.Duration) net.Dialer {
|
|||
KeepAlive: time.Duration(-1),
|
||||
Control: func(_, _ string, c syscall.RawConn) error {
|
||||
return c.Control(func(fd uintptr) {
|
||||
unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_KEEPALIVE, 1)
|
||||
_ = unix.SetsockoptInt(int(fd), unix.SOL_SOCKET, unix.SO_KEEPALIVE, 1)
|
||||
})
|
||||
},
|
||||
}
|
||||
|
|
2
pkg/network/cache/client.go
vendored
2
pkg/network/cache/client.go
vendored
|
@ -5,6 +5,7 @@ import (
|
|||
"sync"
|
||||
"time"
|
||||
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/net"
|
||||
clientcore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/client"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-sdk-go/client"
|
||||
)
|
||||
|
@ -25,6 +26,7 @@ type (
|
|||
Key *ecdsa.PrivateKey
|
||||
ResponseCallback func(client.ResponseMetaInfo) error
|
||||
AllowExternal bool
|
||||
DialerSource *net.DialerSource
|
||||
}
|
||||
)
|
||||
|
||||
|
|
5
pkg/network/cache/multi.go
vendored
5
pkg/network/cache/multi.go
vendored
|
@ -4,10 +4,12 @@ import (
|
|||
"context"
|
||||
"errors"
|
||||
"fmt"
|
||||
"net"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
rawclient "git.frostfs.info/TrueCloudLab/frostfs-api-go/v2/rpc/client"
|
||||
internalNet "git.frostfs.info/TrueCloudLab/frostfs-node/internal/net"
|
||||
clientcore "git.frostfs.info/TrueCloudLab/frostfs-node/pkg/core/client"
|
||||
"git.frostfs.info/TrueCloudLab/frostfs-node/pkg/network"
|
||||
metrics "git.frostfs.info/TrueCloudLab/frostfs-observability/metrics/grpc"
|
||||
|
@ -71,6 +73,9 @@ func (x *multiClient) createForAddress(ctx context.Context, addr network.Address
|
|||
metrics.NewStreamClientInterceptor(),
|
||||
tracing.NewStreamClientInterceptor(),
|
||||
),
|
||||
grpc.WithContextDialer(func(ctx context.Context, s string) (net.Conn, error) {
|
||||
return internalNet.DialContextTCP(ctx, s, x.opts.DialerSource.Dialer())
|
||||
}),
|
||||
},
|
||||
}
|
||||
if x.opts.DialTimeout > 0 {
|
||||
|
|
Loading…
Reference in a new issue