Skip to content

Commit

Permalink
Merge pull request #60 from libp2p/feat/rw-close
Browse files Browse the repository at this point in the history
feat: use go-libp2p-core 0.7.0 stream interfaces
  • Loading branch information
Stebalien committed Nov 12, 2020
2 parents 6114641 + 051ed9b commit 5835f56
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions p2p/net/gostream/conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"net"
"time"

"github.com/libp2p/go-libp2p-core/helpers"
"github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
Expand Down Expand Up @@ -36,12 +35,7 @@ func (c *conn) Write(b []byte) (n int, err error) {
// Close closes the connection.
// Any blocked Read or Write operations will be unblocked and return errors.
func (c *conn) Close() error {
if err := c.s.Close(); err != nil {
c.s.Reset()
return err
}
go helpers.AwaitEOF(c.s)
return nil
return c.s.Close()
}

// LocalAddr returns the local network address.
Expand Down

0 comments on commit 5835f56

Please sign in to comment.