fix timeout when testing
This commit is contained in:
parent
8d16b2d0b5
commit
89584a3a33
@ -14,9 +14,9 @@ import (
|
|||||||
func init() {
|
func init() {
|
||||||
// SetLogger(&LogLogger{})
|
// SetLogger(&LogLogger{})
|
||||||
// Debug = true
|
// Debug = true
|
||||||
DialTimeout = 500 * time.Millisecond
|
DialTimeout = 1000 * time.Millisecond
|
||||||
HandshakeTimeout = 500 * time.Millisecond
|
HandshakeTimeout = 1000 * time.Millisecond
|
||||||
ConnectTimeout = 500 * time.Millisecond
|
ConnectTimeout = 1000 * time.Millisecond
|
||||||
|
|
||||||
cert, err := GenCertificate()
|
cert, err := GenCertificate()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -12,6 +12,7 @@ import (
|
|||||||
"net/http/httptest"
|
"net/http/httptest"
|
||||||
"net/url"
|
"net/url"
|
||||||
"testing"
|
"testing"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// proxyConn obtains a connection to the proxy server.
|
// proxyConn obtains a connection to the proxy server.
|
||||||
@ -76,14 +77,14 @@ func proxyRoundtrip(client *Client, server *Server, targetURL string, data []byt
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
// conn.SetDeadline(time.Now().Add(500 * time.Millisecond))
|
|
||||||
// defer conn.SetDeadline(time.Time{})
|
|
||||||
|
|
||||||
conn, err = client.Connect(conn, u.Host)
|
conn, err = client.Connect(conn, u.Host)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
conn.SetDeadline(time.Now().Add(500 * time.Millisecond))
|
||||||
|
defer conn.SetDeadline(time.Time{})
|
||||||
|
|
||||||
return httpRoundtrip(conn, targetURL, data)
|
return httpRoundtrip(conn, targetURL, data)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user