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
36c66c0e
Commit
36c66c0e
authored
Aug 17, 2016
by
Jeromy
Committed by
Jeromy Johnson
Aug 18, 2016
Browse files
host: add wait for handshake in proto preknowledge test
parent
fc64ec90
Changes
1
Hide whitespace changes
Inline
Side-by-side
p2p/host/basic/basic_host_test.go
View file @
36c66c0e
...
@@ -194,6 +194,9 @@ func TestHostProtoPreknowledge(t *testing.T) {
...
@@ -194,6 +194,9 @@ func TestHostProtoPreknowledge(t *testing.T) {
defer
h1
.
Close
()
defer
h1
.
Close
()
defer
h2
.
Close
()
defer
h2
.
Close
()
// wait for identify handshake to finish completely
time
.
Sleep
(
time
.
Millisecond
*
20
)
h1
.
SetStreamHandler
(
"/foo"
,
handler
)
h1
.
SetStreamHandler
(
"/foo"
,
handler
)
s
,
err
:=
h2
.
NewStream
(
ctx
,
h1
.
ID
(),
"/foo"
,
"/bar"
,
"/super"
)
s
,
err
:=
h2
.
NewStream
(
ctx
,
h1
.
ID
(),
"/foo"
,
"/bar"
,
"/super"
)
...
@@ -202,8 +205,8 @@ func TestHostProtoPreknowledge(t *testing.T) {
...
@@ -202,8 +205,8 @@ func TestHostProtoPreknowledge(t *testing.T) {
}
}
select
{
select
{
case
<-
conn
:
case
p
:=
<-
conn
:
t
.
Fatal
(
"shouldnt have gotten connection yet, we should have a lazy stream
"
)
t
.
Fatal
(
"shouldnt have gotten connection yet, we should have a lazy stream
: "
,
p
)
case
<-
time
.
After
(
time
.
Millisecond
*
50
)
:
case
<-
time
.
After
(
time
.
Millisecond
*
50
)
:
}
}
...
...
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