Skip to content
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

Add Function to Enable Application Layer to Send Direct Control Messages #562

Merged
merged 4 commits into from
Oct 18, 2024
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions gossipsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -2121,6 +2121,23 @@
return WithRawTracer(gs.tagTracer)
}

// SendControl dispatches the given set of control messages to the given peer.
// The control messages are sent as a single RPC, with the given (optional) messages.
// Args:
//
// p: the peer to send the control messages to.
// ctl: the control messages to send.
// msgs: the messages to send in the same RPC (optional).
// The control messages are piggybacked on the messages.
//
// Returns:
//
// nothing.
func (gs *GossipSubRouter) SendControl(p peer.ID, ctl *pb.ControlMessage, msgs ...*pb.Message) {
out := rpcWithControl(msgs, ctl.Ihave, ctl.Iwant, ctl.Graft, ctl.Prune)

Check failure on line 2137 in gossipsub.go

View workflow job for this annotation

GitHub Actions / go-check / All

not enough arguments in call to rpcWithControl

Check failure on line 2137 in gossipsub.go

View workflow job for this annotation

GitHub Actions / go-check / All

not enough arguments in call to rpcWithControl

Check failure on line 2137 in gossipsub.go

View workflow job for this annotation

GitHub Actions / go-test / ubuntu (go this)

not enough arguments in call to rpcWithControl

Check failure on line 2137 in gossipsub.go

View workflow job for this annotation

GitHub Actions / go-test / ubuntu (go this)

not enough arguments in call to rpcWithControl

Check failure on line 2137 in gossipsub.go

View workflow job for this annotation

GitHub Actions / go-test / ubuntu (go next)

not enough arguments in call to rpcWithControl

Check failure on line 2137 in gossipsub.go

View workflow job for this annotation

GitHub Actions / go-test / ubuntu (go next)

not enough arguments in call to rpcWithControl
gs.sendRPC(p, out)

Check failure on line 2138 in gossipsub.go

View workflow job for this annotation

GitHub Actions / go-check / All

not enough arguments in call to gs.sendRPC

Check failure on line 2138 in gossipsub.go

View workflow job for this annotation

GitHub Actions / go-check / All

not enough arguments in call to gs.sendRPC

Check failure on line 2138 in gossipsub.go

View workflow job for this annotation

GitHub Actions / go-test / ubuntu (go this)

not enough arguments in call to gs.sendRPC

Check failure on line 2138 in gossipsub.go

View workflow job for this annotation

GitHub Actions / go-test / ubuntu (go this)

not enough arguments in call to gs.sendRPC

Check failure on line 2138 in gossipsub.go

View workflow job for this annotation

GitHub Actions / go-test / ubuntu (go next)

not enough arguments in call to gs.sendRPC

Check failure on line 2138 in gossipsub.go

View workflow job for this annotation

GitHub Actions / go-test / ubuntu (go next)

not enough arguments in call to gs.sendRPC
}

func peerListToMap(peers []peer.ID) map[peer.ID]struct{} {
pmap := make(map[peer.ID]struct{})
for _, p := range peers {
Expand Down
Loading