refactor(dialer): it should close idle connections (#457)
Like we did before for the resolver, a dialer should propagate the request to close idle connections to underlying types. See https://github.com/ooni/probe/issues/1591
This commit is contained in:
parent
a3a27b1ebf
commit
7a9499fee3
17 changed files with 207 additions and 36 deletions
|
|
@ -36,7 +36,11 @@ func TestNewCreatesTheExpectedChain(t *testing.T) {
|
|||
if !ok {
|
||||
t.Fatal("not a dnsDialer")
|
||||
}
|
||||
scd, ok := dnsd.Dialer.(*saverConnDialer)
|
||||
dad, ok := dnsd.Dialer.(*netxlite.DialerLegacyAdapter)
|
||||
if !ok {
|
||||
t.Fatal("invalid type")
|
||||
}
|
||||
scd, ok := dad.DialerLegacy.(*saverConnDialer)
|
||||
if !ok {
|
||||
t.Fatal("not a saverConnDialer")
|
||||
}
|
||||
|
|
@ -48,12 +52,16 @@ func TestNewCreatesTheExpectedChain(t *testing.T) {
|
|||
if !ok {
|
||||
t.Fatal("not a loggingDialer")
|
||||
}
|
||||
ewd, ok := ld.Dialer.(*errorsx.ErrorWrapperDialer)
|
||||
dad, ok = ld.Dialer.(*netxlite.DialerLegacyAdapter)
|
||||
if !ok {
|
||||
t.Fatal("invalid type")
|
||||
}
|
||||
ewd, ok := dad.DialerLegacy.(*errorsx.ErrorWrapperDialer)
|
||||
if !ok {
|
||||
t.Fatal("not an errorWrappingDialer")
|
||||
}
|
||||
_, ok = ewd.Dialer.(*net.Dialer)
|
||||
_, ok = ewd.Dialer.(*netxlite.DialerSystem)
|
||||
if !ok {
|
||||
t.Fatal("not a net.Dialer")
|
||||
t.Fatal("not a DialerSystem")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue