From ba119fb1f7ba0ad49f47c34a013bfad4cedaeacf Mon Sep 17 00:00:00 2001 From: Brian Tiger Chow Date: Mon, 2 Feb 2015 06:08:20 -0800 Subject: [PATCH] doc(gcr/c) comment methods --- routing/grandcentral/proxy/standard.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/routing/grandcentral/proxy/standard.go b/routing/grandcentral/proxy/standard.go index 3fe33616f..f32b58800 100644 --- a/routing/grandcentral/proxy/standard.go +++ b/routing/grandcentral/proxy/standard.go @@ -38,6 +38,9 @@ func (p *standard) HandleStream(s inet.Stream) { s.Close() } +// SendMessage sends message to each remote sequentially (randomized order), +// stopping after the first successful response. If all fail, returns the last +// error. func (px *standard) SendMessage(ctx context.Context, m *dhtpb.Message) error { var err error for _, i := range rand.Perm(len(px.Remotes)) { @@ -73,6 +76,9 @@ func (px *standard) sendMessage(ctx context.Context, m *dhtpb.Message, remote pe return nil } +// SendRequest sends the request to each remote sequentially (randomized order), +// stopping after the first successful response. If all fail, returns the last +// error. func (px *standard) SendRequest(ctx context.Context, m *dhtpb.Message) (*dhtpb.Message, error) { var err error for _, i := range rand.Perm(len(px.Remotes)) {