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
b30109df
Commit
b30109df
authored
Feb 12, 2019
by
gluk256
Committed by
Viktor Trón
Feb 12, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
swarm/pss: mutex lifecycle fixed (#19045)
parent
8771fbf3
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
4 deletions
+7
-4
protocol.go
swarm/pss/protocol.go
+7
-4
No files found.
swarm/pss/protocol.go
View file @
b30109df
...
...
@@ -228,6 +228,7 @@ func ToP2pMsg(msg []byte) (p2p.Msg, error) {
// to link the peer to.
// The key must exist in the pss store prior to adding the peer.
func
(
p
*
Protocol
)
AddPeer
(
peer
*
p2p
.
Peer
,
topic
Topic
,
asymmetric
bool
,
key
string
)
(
p2p
.
MsgReadWriter
,
error
)
{
var
ok
bool
rw
:=
&
PssReadWriter
{
Pss
:
p
.
Pss
,
rw
:
make
(
chan
p2p
.
Msg
),
...
...
@@ -242,19 +243,21 @@ func (p *Protocol) AddPeer(peer *p2p.Peer, topic Topic, asymmetric bool, key str
}
if
asymmetric
{
p
.
Pss
.
pubKeyPoolMu
.
Lock
()
if
_
,
ok
:=
p
.
Pss
.
pubKeyPool
[
key
];
!
ok
{
_
,
ok
=
p
.
Pss
.
pubKeyPool
[
key
]
p
.
Pss
.
pubKeyPoolMu
.
Unlock
()
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"asym key does not exist: %s"
,
key
)
}
p
.
Pss
.
pubKeyPoolMu
.
Unlock
()
p
.
RWPoolMu
.
Lock
()
p
.
pubKeyRWPool
[
key
]
=
rw
p
.
RWPoolMu
.
Unlock
()
}
else
{
p
.
Pss
.
symKeyPoolMu
.
Lock
()
if
_
,
ok
:=
p
.
Pss
.
symKeyPool
[
key
];
!
ok
{
_
,
ok
=
p
.
Pss
.
symKeyPool
[
key
]
p
.
Pss
.
symKeyPoolMu
.
Unlock
()
if
!
ok
{
return
nil
,
fmt
.
Errorf
(
"symkey does not exist: %s"
,
key
)
}
p
.
Pss
.
symKeyPoolMu
.
Unlock
()
p
.
RWPoolMu
.
Lock
()
p
.
symKeyRWPool
[
key
]
=
rw
p
.
RWPoolMu
.
Unlock
()
...
...
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