mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
rpc: fix leak in TestClientHTTP by making errc buffered
This avoids adding an extra stop channel.
This commit is contained in:
parent
5da0694ede
commit
42cd72aba4
1 changed files with 2 additions and 9 deletions
|
|
@ -413,21 +413,14 @@ func TestClientHTTP(t *testing.T) {
|
|||
// Launch concurrent requests.
|
||||
var (
|
||||
results = make([]echoResult, 100)
|
||||
errc = make(chan error)
|
||||
errc = make(chan error, len(results))
|
||||
wantResult = echoResult{"a", 1, new(echoArgs)}
|
||||
stop = make(chan struct{})
|
||||
)
|
||||
defer close(stop)
|
||||
defer client.Close()
|
||||
for i := range results {
|
||||
i := i
|
||||
go func() {
|
||||
select {
|
||||
case <-stop:
|
||||
return
|
||||
case errc <- client.Call(&results[i], "test_echo",
|
||||
wantResult.String, wantResult.Int, wantResult.Args):
|
||||
}
|
||||
errc <- client.Call(&results[i], "test_echo", wantResult.String, wantResult.Int, wantResult.Args)
|
||||
}()
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue