Skip to content

Commit

Permalink
fixes deferring closing streams
Browse files Browse the repository at this point in the history
  • Loading branch information
yhassanzadeh13 committed Oct 28, 2020
1 parent dbc419f commit cc27eb3
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions network/gossip/libp2p/libp2pNode_test.go
Expand Up @@ -320,7 +320,7 @@ func (suite *LibP2PNodeTestSuite) TestCreateStreamTimeoutWithUnresponsiveNode()

// create a silent node which never replies
listener, silentNodeAddress := newSilentNode(suite.T())
defer listener.Close()
defer require.NoError(suite.T(), listener.Close())

// setup the context to expire after the default timeout
ctx, cancel := context.WithTimeout(context.Background(), DefaultUnicastTimeout)
Expand Down Expand Up @@ -351,9 +351,7 @@ func (suite *LibP2PNodeTestSuite) TestCreateStreamIsConcurrent() {

// create a silent node which never replies
listener, silentNodeAddress := newSilentNode(suite.T())
defer func() {
require.NoError(suite.T(), listener.Close())
}()
defer require.NoError(suite.T(), listener.Close())

// creates a stream to unresponsive node and makes sure that the stream creation is blocked
blockedCallCh := unittest.RequireNeverReturnBefore(suite.T(),
Expand Down

0 comments on commit cc27eb3

Please sign in to comment.