refactor(netx): the TimeoutDialer is useless (#366)
We already configure a timeout in the underlying dialer, hence there's no point in keeping the TimeoutDialer around. Part of https://github.com/ooni/probe/issues/1507
This commit is contained in:
parent
a647cf4988
commit
8ad17775fa
8 changed files with 21 additions and 100 deletions
|
|
@ -3,11 +3,12 @@ package dialer
|
|||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/ooni/psiphon/oopsi/golang.org/x/net/context"
|
||||
)
|
||||
|
||||
func TestSystemDialer(t *testing.T) {
|
||||
func TestSystemDialerWorks(t *testing.T) {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
cancel() // fail immediately
|
||||
conn, err := Default.DialContext(ctx, "tcp", "8.8.8.8:853")
|
||||
|
|
@ -18,3 +19,10 @@ func TestSystemDialer(t *testing.T) {
|
|||
t.Fatal("expected nil conn here")
|
||||
}
|
||||
}
|
||||
|
||||
func TestUnderlyingDialerHasTimeout(t *testing.T) {
|
||||
expected := 15 * time.Second
|
||||
if underlyingDialer.Timeout != expected {
|
||||
t.Fatal("unexpected timeout value")
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue