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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
elixxir
client
Commits
16c3db3f
Commit
16c3db3f
authored
Jul 20, 2022
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Use utility functions
parent
5743aec6
Branches
Branches containing commit
Tags
Tags containing commit
2 merge requests
!510
Release
,
!275
Implement connection CLI
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmd/connect.go
+2
-38
2 additions, 38 deletions
cmd/connect.go
with
2 additions
and
38 deletions
cmd/connect.go
+
2
−
38
View file @
16c3db3f
...
...
@@ -13,12 +13,10 @@ import (
jww
"github.com/spf13/jwalterweatherman"
"github.com/spf13/viper"
"gitlab.com/elixxir/client/catalog"
"gitlab.com/elixxir/client/cmix"
"gitlab.com/elixxir/client/connect"
"gitlab.com/elixxir/client/e2e"
"gitlab.com/elixxir/client/e2e/receive"
"gitlab.com/elixxir/client/xxdk"
"gitlab.com/xx_network/primitives/id"
"time"
)
...
...
@@ -434,44 +432,10 @@ func miscConnectionFunctions(client *xxdk.E2e, conn connect.Connection) {
// Verify message sends were successful when verifySendFlag is present
if
viper
.
GetBool
(
"verify-sends"
)
{
retryChan
:=
make
(
chan
struct
{})
done
:=
make
(
chan
struct
{},
1
)
// Construct the callback function which
// verifies successful message send or retries
f
:=
func
(
allRoundsSucceeded
,
timedOut
bool
,
rounds
map
[
id
.
Round
]
cmix
.
RoundResult
)
{
printRoundResults
(
rounds
,
roundIDs
,
payload
,
conn
.
GetPartner
()
.
PartnerId
())
if
!
allRoundsSucceeded
{
retryChan
<-
struct
{}{}
}
else
{
done
<-
struct
{}{}
}
}
// Monitor rounds for results
err
:=
client
.
GetCmix
()
.
GetRoundResults
(
paramsE2E
.
CMIXParams
.
Timeout
,
f
,
roundIDs
...
)
if
err
!=
nil
{
jww
.
DEBUG
.
Printf
(
"Could not verify messages were sent "
+
"successfully, resending messages..."
)
if
!
verifySendSuccess
(
client
,
paramsE2E
,
roundIDs
,
conn
.
GetPartner
()
.
PartnerId
(),
payload
)
{
continue
}
select
{
case
<-
retryChan
:
// On a retry, go to the top of the loop
jww
.
DEBUG
.
Printf
(
"Messages were not sent successfully,"
+
" resending messages..."
)
continue
case
<-
done
:
// Close channels on verification success
close
(
done
)
close
(
retryChan
)
break
}
}
jww
.
INFO
.
Printf
(
"[CONN] Sent message %q to %s"
,
msgBody
,
conn
.
GetPartner
()
.
PartnerId
())
...
...
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