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
c8ef4cad
Commit
c8ef4cad
authored
Sep 04, 2015
by
Juan Benet
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1647 from ipfs/fix/mock-notif
fix mock notification test
parents
9dff6132
7217d6a2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
16 additions
and
6 deletions
+16
-6
p2p/net/mock/mock_notif_test.go
p2p/net/mock/mock_notif_test.go
+11
-6
p2p/protocol/identify/id.go
p2p/protocol/identify/id.go
+5
-0
No files found.
p2p/net/mock/mock_notif_test.go
View file @
c8ef4cad
...
...
@@ -111,10 +111,8 @@ func TestNotifications(t *testing.T) {
}
}
streams
:=
make
(
chan
inet
.
Stream
)
for
_
,
s
:=
range
nets
{
s
.
SetStreamHandler
(
func
(
s
inet
.
Stream
)
{
streams
<-
s
s
.
Close
()
})
}
...
...
@@ -123,10 +121,17 @@ func TestNotifications(t *testing.T) {
// unsure where these are coming from
for
i
:=
range
nets
{
n
:=
notifiees
[
i
]
testOCStream
(
n
,
nil
)
testOCStream
(
n
,
nil
)
testOCStream
(
n
,
nil
)
testOCStream
(
n
,
nil
)
for
j
:=
0
;
j
<
len
(
nets
)
-
1
;
j
++
{
testOCStream
(
n
,
nil
)
}
}
streams
:=
make
(
chan
inet
.
Stream
)
for
_
,
s
:=
range
nets
{
s
.
SetStreamHandler
(
func
(
s
inet
.
Stream
)
{
streams
<-
s
s
.
Close
()
})
}
// open a streams in each conn
...
...
p2p/protocol/identify/id.go
View file @
c8ef4cad
...
...
@@ -80,6 +80,8 @@ func (ids *IDService) IdentifyConn(c inet.Conn) {
if
err
!=
nil
{
log
.
Debugf
(
"error opening initial stream for %s"
,
ID
)
log
.
Event
(
context
.
TODO
(),
"IdentifyOpenFailed"
,
c
.
RemotePeer
())
c
.
Close
()
return
}
else
{
bwc
:=
ids
.
Host
.
GetBandwidthReporter
()
s
=
mstream
.
WrapStream
(
s
,
ID
,
bwc
)
...
...
@@ -88,6 +90,9 @@ func (ids *IDService) IdentifyConn(c inet.Conn) {
if
err
:=
protocol
.
WriteHeader
(
s
,
ID
);
err
!=
nil
{
log
.
Debugf
(
"error writing stream header for %s"
,
ID
)
log
.
Event
(
context
.
TODO
(),
"IdentifyOpenFailed"
,
c
.
RemotePeer
())
s
.
Close
()
c
.
Close
()
return
}
ids
.
ResponseHandler
(
s
)
}
...
...
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