mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
rpc/websocket_test : add timer var to make sure the timer finally stopped
This commit is contained in:
parent
e0971d47db
commit
9759ac7816
1 changed files with 3 additions and 6 deletions
|
|
@ -247,12 +247,9 @@ 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 := time.NewTimer(200 * time.Millisecond)
|
||||||
defer func() {
|
defer timer.Stop()
|
||||||
if sendResponse != nil {
|
sendResponse = timer.C
|
||||||
sendResponse.Stop()
|
|
||||||
}
|
|
||||||
}()
|
|
||||||
case <-sendResponse:
|
case <-sendResponse:
|
||||||
t.Logf("server sending response")
|
t.Logf("server sending response")
|
||||||
conn.WriteMessage(websocket.TextMessage, []byte(subNotify))
|
conn.WriteMessage(websocket.TextMessage, []byte(subNotify))
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue