Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
go-libp2p
Commits
784ff9c5
Commit
784ff9c5
authored
Aug 08, 2018
by
Steven Allen
Browse files
fix closing of mock streams in test
parent
f56473fb
Changes
1
Hide whitespace changes
Inline
Side-by-side
p2p/net/mock/mock_notif_test.go
View file @
784ff9c5
...
@@ -114,7 +114,7 @@ func TestNotifications(t *testing.T) {
...
@@ -114,7 +114,7 @@ func TestNotifications(t *testing.T) {
for
_
,
s
:=
range
nets
{
for
_
,
s
:=
range
nets
{
s
.
SetStreamHandler
(
func
(
s
inet
.
Stream
)
{
s
.
SetStreamHandler
(
func
(
s
inet
.
Stream
)
{
s
.
Close
()
inet
.
Full
Close
(
s
)
})
})
}
}
...
@@ -131,7 +131,7 @@ func TestNotifications(t *testing.T) {
...
@@ -131,7 +131,7 @@ func TestNotifications(t *testing.T) {
for
_
,
s
:=
range
nets
{
for
_
,
s
:=
range
nets
{
s
.
SetStreamHandler
(
func
(
s
inet
.
Stream
)
{
s
.
SetStreamHandler
(
func
(
s
inet
.
Stream
)
{
streams
<-
s
streams
<-
s
s
.
Close
()
inet
.
Full
Close
(
s
)
})
})
}
}
...
@@ -146,7 +146,7 @@ func TestNotifications(t *testing.T) {
...
@@ -146,7 +146,7 @@ func TestNotifications(t *testing.T) {
}
else
{
}
else
{
t
.
Logf
(
"%s %s <--%p--> %s %s"
,
c
.
LocalPeer
(),
c
.
LocalMultiaddr
(),
st1
,
c
.
RemotePeer
(),
c
.
RemoteMultiaddr
())
t
.
Logf
(
"%s %s <--%p--> %s %s"
,
c
.
LocalPeer
(),
c
.
LocalMultiaddr
(),
st1
,
c
.
RemotePeer
(),
c
.
RemoteMultiaddr
())
// st1.Write([]byte("hello"))
// st1.Write([]byte("hello"))
st1
.
Close
()
go
inet
.
Full
Close
(
st1
)
st2
:=
<-
streams
st2
:=
<-
streams
t
.
Logf
(
"%s %s <--%p--> %s %s"
,
c2
.
LocalPeer
(),
c2
.
LocalMultiaddr
(),
st2
,
c2
.
RemotePeer
(),
c2
.
RemoteMultiaddr
())
t
.
Logf
(
"%s %s <--%p--> %s %s"
,
c2
.
LocalPeer
(),
c2
.
LocalMultiaddr
(),
st2
,
c2
.
RemotePeer
(),
c2
.
RemoteMultiaddr
())
testOCStream
(
notifiees
[
i
],
st1
)
testOCStream
(
notifiees
[
i
],
st1
)
...
...
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