1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-10-24 15:12:55 +08:00

update go-peerstream dependency

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
Jeromy
2015-10-11 20:22:26 -07:00
parent fef7030cad
commit 31d7f03081
2 changed files with 12 additions and 1 deletions

2
Godeps/Godeps.json generated
View File

@ -196,7 +196,7 @@
},
{
"ImportPath": "github.com/jbenet/go-peerstream",
"Rev": "cfdc29a19c1a209d548670f5c33c5cda2e040143"
"Rev": "f90119e97e8be7b2bdd5e598067b0dc44df63381"
},
{
"ImportPath": "github.com/jbenet/go-random",

View File

@ -44,6 +44,9 @@ type Conn struct {
streams map[*Stream]struct{}
streamLock sync.RWMutex
closed bool
closeLock sync.Mutex
}
func newConn(nconn net.Conn, tconn smux.Conn, s *Swarm) *Conn {
@ -114,6 +117,14 @@ func (c *Conn) Streams() []*Stream {
// Close closes this connection
func (c *Conn) Close() error {
c.closeLock.Lock()
defer c.closeLock.Unlock()
if c.closed {
return nil
}
c.closed = true
// close streams
streams := c.Streams()
for _, s := range streams {