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
6167dd65
Commit
6167dd65
authored
Jan 24, 2019
by
Ferenc Szabo
Committed by
Anton Evangelatov
Jan 24, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swarm/pss: fix data race in notify_test.go (TestStart) (#18518)
parent
684faced
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
4 deletions
+11
-4
notify_test.go
swarm/pss/notify/notify_test.go
+11
-4
No files found.
swarm/pss/notify/notify_test.go
View file @
6167dd65
...
...
@@ -128,7 +128,7 @@ func TestStart(t *testing.T) {
defer
rightSub
.
Unsubscribe
()
updateC
:=
make
(
chan
[]
byte
)
updateMsg
:=
[]
byte
{}
var
updateMsg
[]
byte
ctrlClient
:=
NewController
(
psses
[
rightPub
])
ctrlNotifier
:=
NewController
(
psses
[
leftPub
])
ctrlNotifier
.
NewNotifier
(
"foo.eth"
,
2
,
updateC
)
...
...
@@ -145,17 +145,24 @@ func TestStart(t *testing.T) {
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
copyOfUpdateMsg
:=
make
([]
byte
,
len
(
updateMsg
))
copy
(
copyOfUpdateMsg
,
updateMsg
)
ctrlClientError
:=
make
(
chan
error
,
1
)
ctrlClient
.
Subscribe
(
rsrcName
,
pubkey
,
addrbytes
,
func
(
s
string
,
b
[]
byte
)
error
{
if
s
!=
"foo.eth"
||
!
bytes
.
Equal
(
updateMsg
,
b
)
{
t
.
Fatalf
(
"unexpected result in client handler: '%s':'%x'"
,
s
,
b
)
if
s
!=
"foo.eth"
||
!
bytes
.
Equal
(
copyOfUpdateMsg
,
b
)
{
ctrlClientError
<-
fmt
.
Errorf
(
"unexpected result in client handler: '%s':'%x'"
,
s
,
b
)
}
else
{
log
.
Info
(
"client handler receive"
,
"s"
,
s
,
"b"
,
b
)
}
log
.
Info
(
"client handler receive"
,
"s"
,
s
,
"b"
,
b
)
return
nil
})
var
inMsg
*
pss
.
APIMsg
select
{
case
inMsg
=
<-
rmsgC
:
case
err
:=
<-
ctrlClientError
:
t
.
Fatal
(
err
)
case
<-
ctx
.
Done
()
:
t
.
Fatal
(
ctx
.
Err
())
}
...
...
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