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
p2p
go-p2p-swarm
Commits
fedc1864
Commit
fedc1864
authored
Jul 20, 2017
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
update deps
* Also, make notifications async to prevent them from deadlocking.
parent
f6ab6169
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
15 deletions
+17
-15
package.json
package.json
+6
-6
swarm_notif_test.go
swarm_notif_test.go
+11
-9
No files found.
package.json
View file @
fedc1864
...
...
@@ -69,9 +69,9 @@
},
{
"author"
:
"whyrusleeping"
,
"hash"
:
"Qm
a887khroMXGLJuHLYqqDZXHivAfFPxd2hQ8Z5kucMWTM
"
,
"hash"
:
"Qm
VNPgPmEG4QKaDKkxMPKY34Z53n8efzv1sEh4NTsdhto7
"
,
"name"
:
"go-peerstream"
,
"version"
:
"1.
6.2
"
"version"
:
"1.
7.0
"
},
{
"author"
:
"whyrusleeping"
,
...
...
@@ -81,9 +81,9 @@
},
{
"author"
:
"whyrusleeping"
,
"hash"
:
"Qm
aDBnCnmwPdqWGCJRLnmkfXRTEHp5rt3248Bwk4A7fLvt
"
,
"hash"
:
"Qm
PqPjFBqpx5AEfWYDJqt8w8YhRgPn7jw52omCKrYue4B6
"
,
"name"
:
"go-libp2p-conn"
,
"version"
:
"1.6.
4
"
"version"
:
"1.6.
5
"
},
{
"author"
:
"whyrusleeping"
,
...
...
@@ -117,9 +117,9 @@
},
{
"author"
:
"whyrusleeping"
,
"hash"
:
"Qm
R1fAHJvEyYFdEGn5jVmU4NL5kNSVJ48cduXB2whWbJq2
"
,
"hash"
:
"Qm
cx4KoZ91XS6izLjdkujAMAunAS1YuTgfgASgYaZF5GkR
"
,
"name"
:
"go-addr-util"
,
"version"
:
"1.
1.7
"
"version"
:
"1.
2.0
"
},
{
"hash"
:
"QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52"
,
...
...
swarm_notif_test.go
View file @
fedc1864
...
...
@@ -17,8 +17,10 @@ func streamsSame(a, b inet.Stream) bool {
}
func
TestNotifications
(
t
*
testing
.
T
)
{
const
swarmSize
=
5
ctx
:=
context
.
Background
()
swarms
:=
makeSwarms
(
ctx
,
t
,
5
)
swarms
:=
makeSwarms
(
ctx
,
t
,
swarmSize
)
defer
func
()
{
for
_
,
s
:=
range
swarms
{
s
.
Close
()
...
...
@@ -30,7 +32,7 @@ func TestNotifications(t *testing.T) {
// signup notifs
notifiees
:=
make
([]
*
netNotifiee
,
len
(
swarms
))
for
i
,
swarm
:=
range
swarms
{
n
:=
newNetNotifiee
()
n
:=
newNetNotifiee
(
swarmSize
)
swarm
.
Notify
(
n
)
notifiees
[
i
]
=
n
}
...
...
@@ -184,14 +186,14 @@ type netNotifiee struct {
closedStream
chan
inet
.
Stream
}
func
newNetNotifiee
()
*
netNotifiee
{
func
newNetNotifiee
(
buffer
int
)
*
netNotifiee
{
return
&
netNotifiee
{
listen
:
make
(
chan
ma
.
Multiaddr
),
listenClose
:
make
(
chan
ma
.
Multiaddr
),
connected
:
make
(
chan
inet
.
Conn
),
disconnected
:
make
(
chan
inet
.
Conn
),
openedStream
:
make
(
chan
inet
.
Stream
),
closedStream
:
make
(
chan
inet
.
Stream
),
listen
:
make
(
chan
ma
.
Multiaddr
,
buffer
),
listenClose
:
make
(
chan
ma
.
Multiaddr
,
buffer
),
connected
:
make
(
chan
inet
.
Conn
,
buffer
),
disconnected
:
make
(
chan
inet
.
Conn
,
buffer
),
openedStream
:
make
(
chan
inet
.
Stream
,
buffer
),
closedStream
:
make
(
chan
inet
.
Stream
,
buffer
),
}
}
...
...
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