Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
f7b29ec9
Unverified
Commit
f7b29ec9
authored
Apr 02, 2020
by
ucwong
Committed by
GitHub
Apr 02, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
rpc: add missing timer.Stop calls in websocket tests (#20863)
parent
f98cabad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
5 deletions
+7
-5
websocket_test.go
rpc/websocket_test.go
+7
-5
No files found.
rpc/websocket_test.go
View file @
f7b29ec9
...
@@ -142,6 +142,7 @@ func TestClientWebsocketPing(t *testing.T) {
...
@@ -142,6 +142,7 @@ func TestClientWebsocketPing(t *testing.T) {
// Wait for the subscription result.
// Wait for the subscription result.
timeout
:=
time
.
NewTimer
(
5
*
time
.
Second
)
timeout
:=
time
.
NewTimer
(
5
*
time
.
Second
)
defer
timeout
.
Stop
()
for
{
for
{
select
{
select
{
case
err
:=
<-
sub
.
Err
()
:
case
err
:=
<-
sub
.
Err
()
:
...
@@ -227,9 +228,11 @@ func wsPingTestHandler(t *testing.T, conn *websocket.Conn, shutdown, sendPing <-
...
@@ -227,9 +228,11 @@ func wsPingTestHandler(t *testing.T, conn *websocket.Conn, shutdown, sendPing <-
// Write messages.
// Write messages.
var
(
var
(
sendResponse
<-
chan
time
.
Time
wantPong
string
wantPong
string
timer
=
time
.
NewTimer
(
0
)
)
)
defer
timer
.
Stop
()
<-
timer
.
C
for
{
for
{
select
{
select
{
case
_
,
open
:=
<-
sendPing
:
case
_
,
open
:=
<-
sendPing
:
...
@@ -246,11 +249,10 @@ func wsPingTestHandler(t *testing.T, conn *websocket.Conn, shutdown, sendPing <-
...
@@ -246,11 +249,10 @@ func wsPingTestHandler(t *testing.T, conn *websocket.Conn, shutdown, sendPing <-
t
.
Errorf
(
"got pong with wrong data %q"
,
data
)
t
.
Errorf
(
"got pong with wrong data %q"
,
data
)
}
}
wantPong
=
""
wantPong
=
""
sendResponse
=
time
.
NewTimer
(
200
*
time
.
Millisecond
)
.
C
timer
.
Reset
(
200
*
time
.
Millisecond
)
case
<-
sendResponse
:
case
<-
timer
.
C
:
t
.
Logf
(
"server sending response"
)
t
.
Logf
(
"server sending response"
)
conn
.
WriteMessage
(
websocket
.
TextMessage
,
[]
byte
(
subNotify
))
conn
.
WriteMessage
(
websocket
.
TextMessage
,
[]
byte
(
subNotify
))
sendResponse
=
nil
case
<-
shutdown
:
case
<-
shutdown
:
conn
.
Close
()
conn
.
Close
()
return
return
...
...
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