mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
rpc | put the timer out of the loop
This commit is contained in:
parent
9759ac7816
commit
e7354f6bc0
1 changed files with 2 additions and 2 deletions
|
|
@ -231,6 +231,8 @@ func wsPingTestHandler(t *testing.T, conn *websocket.Conn, shutdown, sendPing <-
|
||||||
sendResponse <-chan time.Time
|
sendResponse <-chan time.Time
|
||||||
wantPong string
|
wantPong string
|
||||||
)
|
)
|
||||||
|
timer := time.NewTimer(200 * time.Millisecond)
|
||||||
|
defer timer.Stop()
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case _, open := <-sendPing:
|
case _, open := <-sendPing:
|
||||||
|
|
@ -247,8 +249,6 @@ 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 = ""
|
||||||
timer := time.NewTimer(200 * time.Millisecond)
|
|
||||||
defer timer.Stop()
|
|
||||||
sendResponse = timer.C
|
sendResponse = timer.C
|
||||||
case <-sendResponse:
|
case <-sendResponse:
|
||||||
t.Logf("server sending response")
|
t.Logf("server sending response")
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue