-
Notifications
You must be signed in to change notification settings - Fork 207
Add threadsafe dynamic direct peer handling to GossipSub #673
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from 6 commits
ef84710
ab0dc0b
c24fe95
0a81e02
bd195ea
2a4b7e2
0c194f7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -83,7 +83,9 @@ func (t *tagTracer) Start(gs *GossipSubRouter, logger *slog.Logger) { | |
| t.logger = logger | ||
|
|
||
| t.idGen = gs.p.idGen | ||
| t.direct = gs.direct | ||
| if gs.direct != nil { | ||
| t.direct = gs.direct | ||
|
||
| } | ||
| } | ||
|
|
||
| func (t *tagTracer) tagPeerIfDirect(p peer.ID) { | ||
|
|
@@ -181,6 +183,20 @@ func (t *tagTracer) nearFirstPeers(msg *Message) []peer.ID { | |
| return peers | ||
| } | ||
|
|
||
| func (t *tagTracer) addDirectPeer(p peer.ID) { | ||
| t.Lock() | ||
|
||
| defer t.Unlock() | ||
| t.direct[p] = struct{}{} | ||
|
||
| t.cmgr.Protect(p, "pubsub:<direct>") | ||
| } | ||
|
|
||
| func (t *tagTracer) removeDirectPeer(p peer.ID) { | ||
| t.Lock() | ||
| defer t.Unlock() | ||
| delete(t.direct, p) | ||
| t.cmgr.Unprotect(p, "pubsub:<direct>") | ||
| } | ||
|
|
||
| // -- RawTracer interface methods | ||
| var _ RawTracer = (*tagTracer)(nil) | ||
|
|
||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.