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
dms3
go-dms3
Commits
ba119fb1
Commit
ba119fb1
authored
Feb 02, 2015
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc(gcr/c) comment methods
parent
770489ab
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
0 deletions
+6
-0
routing/grandcentral/proxy/standard.go
routing/grandcentral/proxy/standard.go
+6
-0
No files found.
routing/grandcentral/proxy/standard.go
View file @
ba119fb1
...
...
@@ -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
))
{
...
...
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