forked from TrueCloudLab/frostfs-node
[#1422] morph: Add dialer source support
Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
This commit is contained in:
parent
67798bb50e
commit
fbdfd503e4
2 changed files with 29 additions and 0 deletions
|
@ -58,6 +58,20 @@ func (s *DialerSource) GrpcContextDialer() func(context.Context, string) (net.Co
|
|||
return nil
|
||||
}
|
||||
|
||||
// NetContextDialer returns net.DialContext dial function.
|
||||
// Returns nil if multinet disabled.
|
||||
func (s *DialerSource) NetContextDialer() func(context.Context, string, string) (net.Conn, error) {
|
||||
s.guard.RLock()
|
||||
defer s.guard.RUnlock()
|
||||
|
||||
if s.c.Enabled {
|
||||
return func(ctx context.Context, network, address string) (net.Conn, error) {
|
||||
return s.md.DialContext(ctx, network, address)
|
||||
}
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *DialerSource) Update(c Config) error {
|
||||
s.guard.Lock()
|
||||
defer s.guard.Unlock()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue