Browse Source

Merge pull request #1687 from tendermint/sdk-1045-memory-leak

do not drain the channel because there is no channel, duh
pull/1693/head
Ethan Buchman 7 years ago
committed by GitHub
parent
commit
32719123d9
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions
  1. +1
    -3
      p2p/conn/connection.go
  2. +7
    -1
      p2p/conn/connection_test.go

+ 1
- 3
p2p/conn/connection.go View File

@ -545,9 +545,7 @@ FOR_LOOP:
// not goroutine-safe
func (c *MConnection) stopPongTimer() {
if c.pongTimer != nil {
if !c.pongTimer.Stop() {
<-c.pongTimer.C
}
_ = c.pongTimer.Stop()
c.pongTimer = nil
}
}


+ 7
- 1
p2p/conn/connection_test.go View File

@ -6,9 +6,11 @@ import (
"testing"
"time"
"github.com/fortytw2/leaktest"
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"github.com/tendermint/go-amino"
amino "github.com/tendermint/go-amino"
"github.com/tendermint/tmlibs/log"
)
@ -242,7 +244,11 @@ func TestMConnectionMultiplePings(t *testing.T) {
}
func TestMConnectionPingPongs(t *testing.T) {
// check that we are not leaking any go-routines
defer leaktest.CheckTimeout(t, 10*time.Second)()
server, client := net.Pipe()
defer server.Close()
defer client.Close()


Loading…
Cancel
Save