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
2d6f7faf
Commit
2d6f7faf
authored
4 years ago
by
Richard T. Carback III
Browse files
Options
Downloads
Patches
Plain Diff
Minor cleanup
parent
b845b6d9
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
api/client.go
+0
-6
0 additions, 6 deletions
api/client.go
api/send.go
+2
-1
2 additions, 1 deletion
api/send.go
cmd/root.go
+4
-4
4 additions, 4 deletions
cmd/root.go
with
6 additions
and
11 deletions
api/client.go
+
0
−
6
View file @
2d6f7faf
...
@@ -356,12 +356,6 @@ func parseNDF(ndfString string) (*ndf.NetworkDefinition, error) {
...
@@ -356,12 +356,6 @@ func parseNDF(ndfString string) (*ndf.NetworkDefinition, error) {
return
ndf
,
nil
return
ndf
,
nil
}
}
func
(
c
*
Client
)
getCMIXPrimeSize
()
int
{
ndf
:=
c
.
network
.
GetInstance
()
.
GetPartialNdf
()
.
Get
()
cmixGrp
,
_
:=
decodeGroups
(
ndf
)
return
len
(
cmixGrp
.
GetPBytes
())
}
// decodeGroups returns the e2e and cmix groups from the ndf
// decodeGroups returns the e2e and cmix groups from the ndf
func
decodeGroups
(
ndf
*
ndf
.
NetworkDefinition
)
(
cmixGrp
,
e2eGrp
*
cyclic
.
Group
)
{
func
decodeGroups
(
ndf
*
ndf
.
NetworkDefinition
)
(
cmixGrp
,
e2eGrp
*
cyclic
.
Group
)
{
largeIntBits
:=
16
largeIntBits
:=
16
...
...
This diff is collapsed.
Click to expand it.
api/send.go
+
2
−
1
View file @
2d6f7faf
...
@@ -46,7 +46,8 @@ func (c *Client) SendCMIX(msg format.Message, param params.CMIX) (id.Round,
...
@@ -46,7 +46,8 @@ func (c *Client) SendCMIX(msg format.Message, param params.CMIX) (id.Round,
// FIXME: this is weird and shouldn't be necessary, but it is.
// FIXME: this is weird and shouldn't be necessary, but it is.
func
(
c
*
Client
)
NewCMIXMessage
(
recipient
*
id
.
ID
,
func
(
c
*
Client
)
NewCMIXMessage
(
recipient
*
id
.
ID
,
contents
[]
byte
)
format
.
Message
{
contents
[]
byte
)
format
.
Message
{
msg
:=
format
.
NewMessage
(
c
.
getCMIXPrimeSize
())
primeSize
:=
len
(
c
.
storage
.
Cmix
()
.
GetGroup
()
.
GetPBytes
())
msg
:=
format
.
NewMessage
(
primeSize
)
msg
.
SetContents
(
contents
)
msg
.
SetContents
(
contents
)
msg
.
SetRecipientID
(
recipient
)
msg
.
SetRecipientID
(
recipient
)
return
msg
return
msg
...
...
This diff is collapsed.
Click to expand it.
cmd/root.go
+
4
−
4
View file @
2d6f7faf
...
@@ -163,7 +163,7 @@ var rootCmd = &cobra.Command{
...
@@ -163,7 +163,7 @@ var rootCmd = &cobra.Command{
connected
:=
make
(
chan
bool
,
1
)
connected
:=
make
(
chan
bool
,
1
)
client
.
GetHealth
()
.
AddChannel
(
connected
)
client
.
GetHealth
()
.
AddChannel
(
connected
)
waitTimeout
:=
time
.
Duration
(
viper
.
GetUint
(
"waitTimeout"
))
waitTimeout
:=
time
.
Duration
(
viper
.
GetUint
(
"waitTimeout"
))
timeoutTi
ck
:=
time
.
NewTi
ck
er
(
waitTimeout
*
time
.
Second
)
timeoutTi
mer
:=
time
.
NewTi
m
er
(
waitTimeout
*
time
.
Second
)
isConnected
:=
false
isConnected
:=
false
for
!
isConnected
{
for
!
isConnected
{
select
{
select
{
...
@@ -171,7 +171,7 @@ var rootCmd = &cobra.Command{
...
@@ -171,7 +171,7 @@ var rootCmd = &cobra.Command{
jww
.
INFO
.
Printf
(
"health status: %v
\n
"
,
jww
.
INFO
.
Printf
(
"health status: %v
\n
"
,
isConnected
)
isConnected
)
break
break
case
<-
timeoutTi
ck
.
C
:
case
<-
timeoutTi
mer
.
C
:
jww
.
FATAL
.
Panic
(
"timeout on connection"
)
jww
.
FATAL
.
Panic
(
"timeout on connection"
)
}
}
}
}
...
@@ -198,11 +198,11 @@ var rootCmd = &cobra.Command{
...
@@ -198,11 +198,11 @@ var rootCmd = &cobra.Command{
// Wait until message timeout or we receive enough then exit
// Wait until message timeout or we receive enough then exit
// TODO: Actually check for how many messages we've received
// TODO: Actually check for how many messages we've received
receiveCnt
:=
viper
.
GetUint
(
"receiveCount"
)
receiveCnt
:=
viper
.
GetUint
(
"receiveCount"
)
timeoutTi
ck
=
time
.
NewTi
ck
er
(
waitTimeout
*
time
.
Second
)
timeoutTi
mer
=
time
.
NewTi
m
er
(
waitTimeout
*
time
.
Second
)
done
:=
false
done
:=
false
for
!
done
{
for
!
done
{
select
{
select
{
case
<-
timeoutTi
ck
.
C
:
case
<-
timeoutTi
mer
.
C
:
fmt
.
Println
(
"Timed out!"
)
fmt
.
Println
(
"Timed out!"
)
done
=
true
done
=
true
break
break
...
...
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