Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
dce533c2
Unverified
Commit
dce533c2
authored
Jun 23, 2020
by
ucwong
Committed by
GitHub
Jun 23, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
whisper: fix time.sleep by time.ticker in whisper_test (#21251)
parent
9a188c97
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
20 additions
and
10 deletions
+20
-10
whisper_test.go
whisper/whisperv6/whisper_test.go
+20
-10
No files found.
whisper/whisperv6/whisper_test.go
View file @
dce533c2
...
...
@@ -489,8 +489,10 @@ func TestExpiry(t *testing.T) {
// wait till received or timeout
var
received
,
expired
bool
ticker
:=
time
.
NewTicker
(
100
*
time
.
Millisecond
)
defer
ticker
.
Stop
()
for
j
:=
0
;
j
<
20
;
j
++
{
time
.
Sleep
(
100
*
time
.
Millisecond
)
<-
ticker
.
C
if
len
(
w
.
Envelopes
())
==
messagesCount
{
received
=
true
break
...
...
@@ -503,7 +505,7 @@ func TestExpiry(t *testing.T) {
// wait till expired or timeout
for
j
:=
0
;
j
<
20
;
j
++
{
time
.
Sleep
(
100
*
time
.
Millisecond
)
<-
ticker
.
C
if
len
(
w
.
Envelopes
())
==
0
{
expired
=
true
break
...
...
@@ -582,8 +584,10 @@ func TestCustomization(t *testing.T) {
// wait till received or timeout
var
received
bool
ticker
:=
time
.
NewTicker
(
100
*
time
.
Millisecond
)
defer
ticker
.
Stop
()
for
j
:=
0
;
j
<
20
;
j
++
{
time
.
Sleep
(
100
*
time
.
Millisecond
)
<-
ticker
.
C
if
len
(
w
.
Envelopes
())
>
1
{
received
=
true
break
...
...
@@ -599,7 +603,7 @@ func TestCustomization(t *testing.T) {
if
err
!=
nil
{
t
.
Fatalf
(
"failed subscribe with seed %d: %s."
,
seed
,
err
)
}
time
.
Sleep
(
5
*
time
.
Millisecond
)
<-
ticker
.
C
mail
:=
f
.
Retrieve
()
if
len
(
mail
)
>
0
{
t
.
Fatalf
(
"received premature mail"
)
...
...
@@ -670,8 +674,10 @@ func TestSymmetricSendCycle(t *testing.T) {
// wait till received or timeout
var
received
bool
ticker
:=
time
.
NewTicker
(
10
*
time
.
Millisecond
)
defer
ticker
.
Stop
()
for
j
:=
0
;
j
<
200
;
j
++
{
time
.
Sleep
(
10
*
time
.
Millisecond
)
<-
ticker
.
C
if
len
(
w
.
Envelopes
())
>
0
{
received
=
true
break
...
...
@@ -683,7 +689,7 @@ func TestSymmetricSendCycle(t *testing.T) {
}
// check w.messages()
time
.
Sleep
(
5
*
time
.
Millisecond
)
<-
ticker
.
C
mail1
:=
filter1
.
Retrieve
()
mail2
:=
filter2
.
Retrieve
()
if
len
(
mail2
)
==
0
{
...
...
@@ -743,8 +749,10 @@ func TestSymmetricSendWithoutAKey(t *testing.T) {
// wait till received or timeout
var
received
bool
ticker
:=
time
.
NewTicker
(
10
*
time
.
Millisecond
)
defer
ticker
.
Stop
()
for
j
:=
0
;
j
<
200
;
j
++
{
time
.
Sleep
(
10
*
time
.
Millisecond
)
<-
ticker
.
C
if
len
(
w
.
Envelopes
())
>
0
{
received
=
true
break
...
...
@@ -756,7 +764,7 @@ func TestSymmetricSendWithoutAKey(t *testing.T) {
}
// check w.messages()
time
.
Sleep
(
5
*
time
.
Millisecond
)
<-
ticker
.
C
mail
:=
filter
.
Retrieve
()
if
len
(
mail
)
==
0
{
t
.
Fatalf
(
"did not receive message in spite of not setting a public key"
)
...
...
@@ -809,8 +817,10 @@ func TestSymmetricSendKeyMismatch(t *testing.T) {
// wait till received or timeout
var
received
bool
ticker
:=
time
.
NewTicker
(
10
*
time
.
Millisecond
)
defer
ticker
.
Stop
()
for
j
:=
0
;
j
<
200
;
j
++
{
time
.
Sleep
(
10
*
time
.
Millisecond
)
<-
ticker
.
C
if
len
(
w
.
Envelopes
())
>
0
{
received
=
true
break
...
...
@@ -822,7 +832,7 @@ func TestSymmetricSendKeyMismatch(t *testing.T) {
}
// check w.messages()
time
.
Sleep
(
5
*
time
.
Millisecond
)
<-
ticker
.
C
mail
:=
filter
.
Retrieve
()
if
len
(
mail
)
>
0
{
t
.
Fatalf
(
"received a message when keys weren't matching"
)
...
...
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