doc(gcr/c) comment methods
Brian Tiger Chow committed
Feb 2, 2015 at 06:08 UTC
ba119fb1f7ba0ad49f47c34a013bfad4cedaeacf
1 file changed
+6
routing/grandcentral/proxy/standard.go
+6
@@ -38,6 +38,9 @@ func (p *standard) HandleStream(s inet.Stream) {
38
s.Close()
39
}
40
41
+// SendMessage sends message to each remote sequentially (randomized order),
42
+// stopping after the first successful response. If all fail, returns the last
43
+// error.
44
func (px *standard) SendMessage(ctx context.Context, m *dhtpb.Message) error {
45
var err error
46
for _, i := range rand.Perm(len(px.Remotes)) {
@@ -73,6 +76,9 @@ func (px *standard) sendMessage(ctx context.Context, m *dhtpb.Message, remote pe
76
return nil
77
}
78
79
+// SendRequest sends the request to each remote sequentially (randomized order),
80
+// stopping after the first successful response. If all fail, returns the last
81
+// error.
82
func (px *standard) SendRequest(ctx context.Context, m *dhtpb.Message) (*dhtpb.Message, error) {
83
var err error
84
for _, i := range rand.Perm(len(px.Remotes)) {