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
p2p
go-p2p-pubsub
Commits
8e4a9489
Commit
8e4a9489
authored
May 11, 2020
by
Yusef Napora
Committed by
vyzo
May 19, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
lock for reading in bumpDeliveryTag
parent
2312cdda
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
1 deletion
+4
-1
tag_tracer.go
tag_tracer.go
+4
-1
No files found.
tag_tracer.go
View file @
8e4a9489
...
@@ -52,7 +52,7 @@ var (
...
@@ -52,7 +52,7 @@ var (
// The delivery tags have a maximum value, GossipSubConnTagMessageDeliveryCap, and they decay at
// The delivery tags have a maximum value, GossipSubConnTagMessageDeliveryCap, and they decay at
// a rate of GossipSubConnTagDecayAmount / GossipSubConnTagDecayInterval.
// a rate of GossipSubConnTagDecayAmount / GossipSubConnTagDecayInterval.
type
tagTracer
struct
{
type
tagTracer
struct
{
sync
.
Mutex
sync
.
RW
Mutex
cmgr
connmgr
.
ConnManager
cmgr
connmgr
.
ConnManager
decayer
connmgr
.
Decayer
decayer
connmgr
.
Decayer
...
@@ -144,6 +144,9 @@ func (t *tagTracer) decayingDeliveryTag(topic string) (connmgr.DecayingTag, erro
...
@@ -144,6 +144,9 @@ func (t *tagTracer) decayingDeliveryTag(topic string) (connmgr.DecayingTag, erro
}
}
func
(
t
*
tagTracer
)
bumpDeliveryTag
(
p
peer
.
ID
,
topic
string
)
error
{
func
(
t
*
tagTracer
)
bumpDeliveryTag
(
p
peer
.
ID
,
topic
string
)
error
{
t
.
RLock
()
defer
t
.
RUnlock
()
tag
,
ok
:=
t
.
decaying
[
topic
]
tag
,
ok
:=
t
.
decaying
[
topic
]
if
!
ok
{
if
!
ok
{
return
fmt
.
Errorf
(
"no decaying tag registered for topic %s"
,
topic
)
return
fmt
.
Errorf
(
"no decaying tag registered for topic %s"
,
topic
)
...
...
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