mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-08-20 10:52:25 +00:00
common, eth, p2p, rpc: add 1 buffer to fix goroutine leak in tests
This commit is contained in:
parent
96490a10be
commit
eb3e02b64f
4 changed files with 5 additions and 5 deletions
|
|
@ -96,7 +96,7 @@ func TestSimulatedSleep(t *testing.T) {
|
||||||
var (
|
var (
|
||||||
c Simulated
|
c Simulated
|
||||||
timeout = 1 * time.Hour
|
timeout = 1 * time.Hour
|
||||||
done = make(chan AbsTime)
|
done = make(chan AbsTime, 1)
|
||||||
)
|
)
|
||||||
go func() {
|
go func() {
|
||||||
c.Sleep(timeout)
|
c.Sleep(timeout)
|
||||||
|
|
|
||||||
|
|
@ -677,7 +677,7 @@ func TestBroadcastMalformedBlock(t *testing.T) {
|
||||||
malformedEverything.TxHash[0]++
|
malformedEverything.TxHash[0]++
|
||||||
|
|
||||||
// Keep listening to broadcasts and notify if any arrives
|
// Keep listening to broadcasts and notify if any arrives
|
||||||
notify := make(chan struct{})
|
notify := make(chan struct{}, 1)
|
||||||
go func() {
|
go func() {
|
||||||
if _, err := sink.app.ReadMsg(); err == nil {
|
if _, err := sink.app.ReadMsg(); err == nil {
|
||||||
notify <- struct{}{}
|
notify <- struct{}{}
|
||||||
|
|
|
||||||
|
|
@ -131,7 +131,7 @@ func TestServerDial(t *testing.T) {
|
||||||
t.Fatalf("could not setup listener: %v", err)
|
t.Fatalf("could not setup listener: %v", err)
|
||||||
}
|
}
|
||||||
defer listener.Close()
|
defer listener.Close()
|
||||||
accepted := make(chan net.Conn)
|
accepted := make(chan net.Conn, 1)
|
||||||
go func() {
|
go func() {
|
||||||
conn, err := listener.Accept()
|
conn, err := listener.Accept()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
@ -670,7 +670,7 @@ func TestServerInboundThrottle(t *testing.T) {
|
||||||
conn.Close()
|
conn.Close()
|
||||||
|
|
||||||
// Dial again. This time the server should close the connection immediately.
|
// Dial again. This time the server should close the connection immediately.
|
||||||
connClosed := make(chan struct{})
|
connClosed := make(chan struct{}, 1)
|
||||||
conn, err = net.DialTimeout("tcp", srv.ListenAddr, timeout)
|
conn, err = net.DialTimeout("tcp", srv.ListenAddr, timeout)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("could not dial: %v", err)
|
t.Fatalf("could not dial: %v", err)
|
||||||
|
|
|
||||||
|
|
@ -297,7 +297,7 @@ func TestClientSubscribeClose(t *testing.T) {
|
||||||
|
|
||||||
var (
|
var (
|
||||||
nc = make(chan int)
|
nc = make(chan int)
|
||||||
errc = make(chan error)
|
errc = make(chan error, 1)
|
||||||
sub *ClientSubscription
|
sub *ClientSubscription
|
||||||
err error
|
err error
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue