Commit 31d7f030 authored by Jeromy's avatar Jeromy

update go-peerstream dependency

License: MIT
Signed-off-by: default avatarJeromy <jeromyj@gmail.com>
parent fef7030c
......@@ -196,7 +196,7 @@
},
{
"ImportPath": "github.com/jbenet/go-peerstream",
"Rev": "cfdc29a19c1a209d548670f5c33c5cda2e040143"
"Rev": "f90119e97e8be7b2bdd5e598067b0dc44df63381"
},
{
"ImportPath": "github.com/jbenet/go-random",
......
......@@ -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 {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment