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
ea314605
Commit
ea314605
authored
Mar 27, 2020
by
vyzo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
don't forward messages with source ourselves but not published by ourselves
per stebalien's request.
parent
0cab7f5e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletion
+7
-1
gossipsub.go
gossipsub.go
+7
-1
No files found.
gossipsub.go
View file @
ea314605
...
...
@@ -556,6 +556,12 @@ func (gs *GossipSubRouter) connector() {
}
func
(
gs
*
GossipSubRouter
)
Publish
(
msg
*
Message
)
{
self
:=
gs
.
p
.
host
.
ID
()
if
peer
.
ID
(
msg
.
GetFrom
())
==
self
&&
msg
.
ReceivedFrom
!=
self
{
// we don't forward messages claiming to be from us but not published by ourselves
return
}
gs
.
mcache
.
Put
(
msg
.
Message
)
from
:=
msg
.
ReceivedFrom
...
...
@@ -567,7 +573,7 @@ func (gs *GossipSubRouter) Publish(msg *Message) {
continue
}
if
gs
.
floodPublish
&&
from
==
gs
.
p
.
host
.
ID
()
{
if
gs
.
floodPublish
&&
from
==
self
{
for
p
:=
range
tmap
{
if
gs
.
score
.
Score
(
p
)
>=
gs
.
publishThreshold
{
tosend
[
p
]
=
struct
{}{}
...
...
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