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
717859b2
Commit
717859b2
authored
3 years ago
by
Benjamin Wenger
Browse files
Options
Downloads
Patches
Plain Diff
started woprking on API
parent
26a65e1c
No related branches found
No related tags found
3 merge requests
!510
Release
,
!207
WIP: Client Restructure
,
!203
Symmetric broadcast
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
single/receivedRequest.go
+13
-1
13 additions, 1 deletion
single/receivedRequest.go
with
13 additions
and
1 deletion
single/receivedRequest.go
+
13
−
1
View file @
717859b2
...
@@ -66,6 +66,7 @@ func (r Request) String() string {
...
@@ -66,6 +66,7 @@ func (r Request) String() string {
r
.
dhKey
.
Text
(
10
),
r
.
tag
,
r
.
maxParts
)
r
.
dhKey
.
Text
(
10
),
r
.
tag
,
r
.
maxParts
)
}
}
//
func
(
r
Request
)
Respond
(
payload
[]
byte
,
cmixParams
cmix
.
CMIXParams
,
func
(
r
Request
)
Respond
(
payload
[]
byte
,
cmixParams
cmix
.
CMIXParams
,
timeout
time
.
Duration
)
([]
id
.
Round
,
error
)
{
timeout
time
.
Duration
)
([]
id
.
Round
,
error
)
{
// make sure this has only been run once
// make sure this has only been run once
...
@@ -104,6 +105,8 @@ func (r Request) Respond(payload []byte, cmixParams cmix.CMIXParams,
...
@@ -104,6 +105,8 @@ func (r Request) Respond(payload []byte, cmixParams cmix.CMIXParams,
Metadata
:
nil
,
Metadata
:
nil
,
}
}
failed
:=
uint32
(
0
)
for
i
:=
0
;
i
<
len
(
parts
);
i
++
{
for
i
:=
0
;
i
<
len
(
parts
);
i
++
{
// fixme: handle the case where a send fails, also on failures,
// fixme: handle the case where a send fails, also on failures,
// unset use
// unset use
...
@@ -114,6 +117,7 @@ func (r Request) Respond(payload []byte, cmixParams cmix.CMIXParams,
...
@@ -114,6 +117,7 @@ func (r Request) Respond(payload []byte, cmixParams cmix.CMIXParams,
round
,
ephID
,
err
:=
r
.
net
.
Send
(
r
.
sender
,
partFP
,
svc
,
ecrPart
,
mac
,
round
,
ephID
,
err
:=
r
.
net
.
Send
(
r
.
sender
,
partFP
,
svc
,
ecrPart
,
mac
,
cmixParams
)
cmixParams
)
if
err
!=
nil
{
if
err
!=
nil
{
atomic
.
AddUint32
(
&
failed
,
1
)
jww
.
ERROR
.
Printf
(
"Failed to send single-use response CMIX "
+
jww
.
ERROR
.
Printf
(
"Failed to send single-use response CMIX "
+
"message part %d: %+v"
,
j
,
err
)
"message part %d: %+v"
,
j
,
err
)
}
}
...
@@ -128,13 +132,21 @@ func (r Request) Respond(payload []byte, cmixParams cmix.CMIXParams,
...
@@ -128,13 +132,21 @@ func (r Request) Respond(payload []byte, cmixParams cmix.CMIXParams,
// Wait for all go routines to finish
// Wait for all go routines to finish
wg
.
Wait
()
wg
.
Wait
()
if
failed
>
0
{
return
nil
,
errors
.
Errorf
(
"One or more send failed for the "
+
"response, the response will be handleable and will timeout"
)
}
jww
.
DEBUG
.
Printf
(
"Sent %d single-use response CMIX messages to %s."
,
jww
.
DEBUG
.
Printf
(
"Sent %d single-use response CMIX messages to %s."
,
len
(
parts
),
r
.
sender
)
len
(
parts
),
r
.
sender
)
// Count the number of rounds
// Count the number of rounds
roundMap
:=
map
[
id
.
Round
]
struct
{}{}
roundMap
:=
map
[
id
.
Round
]
struct
{}{}
for
_
,
roundID
:=
range
rounds
{
for
_
,
roundID
:=
range
rounds
{
roundMap
[
roundID
]
=
struct
{}{}
if
roundID
!=
0
{
roundMap
[
roundID
]
=
struct
{}{}
}
}
}
// Wait until the result tracking responds
// Wait until the result tracking responds
...
...
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