Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
gost
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nanahira
gost
Commits
89584a3a
Commit
89584a3a
authored
Dec 23, 2018
by
ginuerzh
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix timeout when testing
parent
8d16b2d0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
6 deletions
+7
-6
common_test.go
common_test.go
+3
-3
http_test.go
http_test.go
+4
-3
No files found.
common_test.go
View file @
89584a3a
...
@@ -14,9 +14,9 @@ import (
...
@@ -14,9 +14,9 @@ import (
func
init
()
{
func
init
()
{
// SetLogger(&LogLogger{})
// SetLogger(&LogLogger{})
// Debug = true
// Debug = true
DialTimeout
=
5
00
*
time
.
Millisecond
DialTimeout
=
10
00
*
time
.
Millisecond
HandshakeTimeout
=
5
00
*
time
.
Millisecond
HandshakeTimeout
=
10
00
*
time
.
Millisecond
ConnectTimeout
=
5
00
*
time
.
Millisecond
ConnectTimeout
=
10
00
*
time
.
Millisecond
cert
,
err
:=
GenCertificate
()
cert
,
err
:=
GenCertificate
()
if
err
!=
nil
{
if
err
!=
nil
{
...
...
http_test.go
View file @
89584a3a
...
@@ -12,6 +12,7 @@ import (
...
@@ -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
...
@@ -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
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment