Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
client
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Analyze
Contributor analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
cdf2ab55
Commit
cdf2ab55
authored
4 years ago
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Add check for full rounds to sendCmix and retry
parent
72b96798
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
network/message/sendCmix.go
+11
-4
11 additions, 4 deletions
network/message/sendCmix.go
with
11 additions
and
4 deletions
network/message/sendCmix.go
+
11
−
4
View file @
cdf2ab55
...
...
@@ -10,6 +10,7 @@ import (
"gitlab.com/elixxir/primitives/format"
"gitlab.com/xx_network/comms/connect"
"gitlab.com/xx_network/primitives/id"
"strings"
"time"
)
...
...
@@ -34,7 +35,7 @@ func (m *Manager) SendCMIX(msg format.Message, param params.CMIX) (id.Round, err
}
remainingTime
:=
param
.
Timeout
-
elapsed
//find the best round to send to, excluding
roudn which have been
attempted
//find the best round to send to, excluding attempted
rounds
bestRound
,
_
:=
m
.
Instance
.
GetWaitingRounds
()
.
GetUpcomingRealtime
(
remainingTime
,
attempted
)
//build the topology
...
...
@@ -95,19 +96,25 @@ func (m *Manager) SendCMIX(msg format.Message, param params.CMIX) (id.Round, err
//Add the mac proving ownership
msg
.
MAC
=
roundKeys
.
MakeClientGatewayKey
(
salt
,
network
.
GenerateSlotDigest
(
msg
))
//add the round on to the list of attempted so it is not tried again
attempted
.
Insert
(
bestRound
)
//Send the payload
gwSlotResp
,
err
:=
m
.
Comms
.
SendPutMessage
(
transmitGateway
,
msg
)
//if the comm errors or the message fails to send, continue retrying.
//return if it sends properly
if
err
!=
nil
{
if
strings
.
Contains
(
err
.
Error
(),
"try a different round."
)
{
jww
.
WARN
.
Printf
(
"could not send: %s"
,
err
)
continue
}
jww
.
ERROR
.
Printf
(
"Failed to send message to %s: %s"
,
transmitGateway
,
err
)
}
else
if
gwSlotResp
.
Accepted
{
return
id
.
Round
(
bestRound
.
ID
),
nil
}
//add the round on to the list of attempted so it is not tried again
attempted
.
Insert
(
bestRound
)
}
return
0
,
errors
.
New
(
"failed to send the message"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment