Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
2253d08d
Commit
2253d08d
authored
Dec 07, 2015
by
Juan Benet
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2048 from ipfs/deps/go-peerstream
update go-peerstream dep
parents
d58053b2
edc7b0f6
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
25 additions
and
4 deletions
+25
-4
Godeps/Godeps.json
Godeps/Godeps.json
+1
-1
Godeps/_workspace/src/github.com/jbenet/go-peerstream/conn.go
...ps/_workspace/src/github.com/jbenet/go-peerstream/conn.go
+22
-2
Godeps/_workspace/src/github.com/jbenet/go-peerstream/muxtest/muxt.go
...space/src/github.com/jbenet/go-peerstream/muxtest/muxt.go
+1
-0
Godeps/_workspace/src/github.com/jbenet/go-peerstream/swarm.go
...s/_workspace/src/github.com/jbenet/go-peerstream/swarm.go
+1
-1
No files found.
Godeps/Godeps.json
View file @
2253d08d
...
...
@@ -200,7 +200,7 @@
},
{
"ImportPath"
:
"github.com/jbenet/go-peerstream"
,
"Rev"
:
"f
90119e97e8be7b2bdd5e598067b0dc44df63381
"
"Rev"
:
"f
3ab20739a88aa79306dc039c1b5a39e7afa45d6
"
},
{
"ImportPath"
:
"github.com/jbenet/go-random"
,
...
...
Godeps/_workspace/src/github.com/jbenet/go-peerstream/conn.go
View file @
2253d08d
...
...
@@ -47,6 +47,9 @@ type Conn struct {
closed
bool
closeLock
sync
.
Mutex
closing
bool
closingLock
sync
.
Mutex
}
func
newConn
(
nconn
net
.
Conn
,
tconn
smux
.
Conn
,
s
*
Swarm
)
*
Conn
{
...
...
@@ -115,14 +118,31 @@ func (c *Conn) Streams() []*Stream {
return
streams
}
// GoClose spawns off a goroutine to close the connection iff the connection is
// not already being closed and returns immediately
func
(
c
*
Conn
)
GoClose
()
{
c
.
closingLock
.
Lock
()
defer
c
.
closingLock
.
Unlock
()
if
c
.
closing
{
return
}
c
.
closing
=
true
go
c
.
Close
()
}
// Close closes this connection
func
(
c
*
Conn
)
Close
()
error
{
c
.
closeLock
.
Lock
()
defer
c
.
closeLock
.
Unlock
()
if
c
.
closed
{
if
c
.
closed
==
true
{
return
nil
}
c
.
closingLock
.
Lock
()
c
.
closing
=
true
c
.
closingLock
.
Unlock
()
c
.
closed
=
true
// close streams
...
...
Godeps/_workspace/src/github.com/jbenet/go-peerstream/muxtest/muxt.go
View file @
2253d08d
...
...
@@ -14,6 +14,7 @@ import (
"testing"
ps
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-peerstream"
smux
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-stream-muxer"
)
...
...
Godeps/_workspace/src/github.com/jbenet/go-peerstream/swarm.go
View file @
2253d08d
...
...
@@ -184,7 +184,7 @@ func (s *Swarm) Conns() []*Conn {
open
:=
make
([]
*
Conn
,
0
,
len
(
conns
))
for
_
,
c
:=
range
conns
{
if
c
.
smuxConn
.
IsClosed
()
{
c
.
Close
()
c
.
Go
Close
()
}
else
{
open
=
append
(
open
,
c
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment