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
Automate
Agent sessions
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
d5e78cb5
Commit
d5e78cb5
authored
Oct 5, 2022
by
benjamin
Browse files
Options
Downloads
Patches
Plain Diff
made the system denote a failed send as a failed message
parent
6cfac346
No related branches found
No related tags found
4 merge requests
!510
Release
,
!419
rewrote the health tracker to both consider if there are waiting rounds and...
,
!401
finished building and documenting the sent status system and fixing extant...
,
!340
Project/channels
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
channels/send.go
+15
-1
15 additions, 1 deletion
channels/send.go
channels/sendTracker.go
+29
-10
29 additions, 10 deletions
channels/sendTracker.go
channels/sendTracker_test.go
+19
-20
19 additions, 20 deletions
channels/sendTracker_test.go
with
63 additions
and
31 deletions
channels/send.go
+
15
−
1
View file @
d5e78cb5
...
...
@@ -10,6 +10,7 @@ package channels
import
(
"crypto/ed25519"
"github.com/pkg/errors"
jww
"github.com/spf13/jwalterweatherman"
"gitlab.com/elixxir/client/cmix"
"gitlab.com/elixxir/client/cmix/rounds"
cryptoChannel
"gitlab.com/elixxir/crypto/channel"
...
...
@@ -115,6 +116,11 @@ func (m *manager) SendGeneric(channelID *id.ID, messageType MessageType,
r
,
ephid
,
err
:=
ch
.
broadcast
.
BroadcastWithAssembler
(
assemble
,
params
)
if
err
!=
nil
{
errDenote
:=
m
.
st
.
failedSend
(
uuid
)
if
errDenote
!=
nil
{
jww
.
ERROR
.
Printf
(
"Failed to update for a failed send to "
+
"%s: %+v"
,
channelID
,
err
)
}
return
cryptoChannel
.
MessageID
{},
rounds
.
Round
{},
ephemeral
.
Id
{},
err
}
err
=
m
.
st
.
send
(
uuid
,
msgId
,
r
)
...
...
@@ -192,8 +198,16 @@ func (m *manager) SendAdminGeneric(privKey rsa.PrivateKey, channelID *id.ID,
r
,
ephid
,
err
:=
ch
.
broadcast
.
BroadcastRSAToPublicWithAssembler
(
privKey
,
assemble
,
params
)
if
err
!=
nil
{
errDenote
:=
m
.
st
.
failedSend
(
uuid
)
if
errDenote
!=
nil
{
jww
.
ERROR
.
Printf
(
"Failed to update for a failed send to "
+
"%s: %+v"
,
channelID
,
err
)
}
return
cryptoChannel
.
MessageID
{},
rounds
.
Round
{},
ephemeral
.
Id
{},
err
}
err
=
m
.
st
.
send
Admin
(
uuid
,
msgId
,
r
)
err
=
m
.
st
.
send
(
uuid
,
msgId
,
r
)
if
err
!=
nil
{
return
cryptoChannel
.
MessageID
{},
rounds
.
Round
{},
ephemeral
.
Id
{},
err
}
...
...
This diff is collapsed.
Click to expand it.
channels/sendTracker.go
+
29
−
10
View file @
d5e78cb5
...
...
@@ -274,22 +274,17 @@ func (st *sendTracker) send(uuid uint64, msgID cryptoChannel.MessageID,
return
nil
}
// sendAdmin tracks a generic sendAdmin message
func
(
st
*
sendTracker
)
sendAdmin
(
uuid
uint64
,
msgID
cryptoChannel
.
MessageID
,
round
rounds
.
Round
)
error
{
// send tracks a generic send message
func
(
st
*
sendTracker
)
failedSend
(
uuid
uint64
)
error
{
// update the on disk message status
t
,
err
:=
st
.
handleSend
(
uuid
,
msgID
,
roun
d
)
t
,
err
:=
st
.
handleSend
Failed
(
uui
d
)
if
err
!=
nil
{
return
err
}
// Modify the timestamp to reduce the chance message order will be ambiguous
ts
:=
mutateTimestamp
(
round
.
Timestamps
[
states
.
QUEUED
],
msgID
)
//update the message on the UI
go
st
.
updateStatus
(
t
.
UUID
,
msgID
,
ts
,
round
,
Sent
)
go
st
.
updateStatus
(
t
.
UUID
,
cryptoChannel
.
MessageID
{},
time
.
Time
{},
rounds
.
Round
{},
Failed
)
return
nil
}
...
...
@@ -329,8 +324,32 @@ func (st *sendTracker) handleSend(uuid uint64,
st.net.GetRoundResults(getRoundResultsTimeout, rr.callback, rr.round)
}*/
delete
(
st
.
unsent
,
uuid
)
//store the changed list to disk
err
:=
st
.
store
()
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
err
.
Error
())
}
return
t
,
nil
}
// handleSendFailed does the nity gritty of editing internal structures
func
(
st
*
sendTracker
)
handleSendFailed
(
uuid
uint64
)
(
*
tracked
,
error
)
{
st
.
mux
.
Lock
()
defer
st
.
mux
.
Unlock
()
//check if in unsent
t
,
exists
:=
st
.
unsent
[
uuid
]
if
!
exists
{
return
nil
,
errors
.
New
(
"cannot handle send on an unprepared message"
)
}
delete
(
st
.
unsent
,
uuid
)
//store the changed list to disk
err
:=
st
.
store
S
ent
()
err
:=
st
.
store
Uns
ent
()
if
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
err
.
Error
())
}
...
...
This diff is collapsed.
Click to expand it.
channels/sendTracker_test.go
+
19
−
20
View file @
d5e78cb5
...
...
@@ -122,10 +122,10 @@ func TestSendTracker_MessageReceive(t *testing.T) {
}
}
// Test
sendAdmin
function, confirming that data is stored appropriately
// Test
failedSend
function, confirming that data is stored appropriately
// and callbacks are called
func
TestSendTracker_
sendAdmin
(
t
*
testing
.
T
)
{
triggerCh
:=
make
(
chan
bool
)
func
TestSendTracker_
failedSend
(
t
*
testing
.
T
)
{
triggerCh
:=
make
(
chan
SentStatus
)
kv
:=
versioned
.
NewKV
(
ekv
.
MakeMemstore
())
...
...
@@ -137,7 +137,7 @@ func TestSendTracker_sendAdmin(t *testing.T) {
updateStatus
:=
func
(
uuid
uint64
,
messageID
cryptoChannel
.
MessageID
,
timestamp
time
.
Time
,
round
rounds
.
Round
,
status
SentStatus
)
{
triggerCh
<-
true
triggerCh
<-
status
}
st
:=
loadSendTracker
(
&
mockClient
{},
kv
,
nil
,
adminTrigger
,
updateStatus
)
...
...
@@ -155,39 +155,38 @@ func TestSendTracker_sendAdmin(t *testing.T) {
t
.
Fatalf
(
err
.
Error
())
}
err
=
st
.
sendAdmin
(
uuid
,
mid
,
rounds
.
Round
{
ID
:
rid
,
State
:
2
,
})
err
=
st
.
failedSend
(
uuid
)
if
err
!=
nil
{
t
.
Fatalf
(
err
.
Error
())
}
timeout
:=
time
.
NewTicker
(
time
.
Second
*
5
)
select
{
case
<-
triggerCh
:
case
s
:=
<-
triggerCh
:
if
s
!=
Failed
{
t
.
Fatalf
(
"Did not receive failed from failed message"
)
}
t
.
Log
(
"Received over trigger chan"
)
case
<-
timeout
.
C
:
t
.
Fatal
(
"Timed out waiting for trigger chan"
)
}
trackedRound
,
ok
:=
st
.
byRound
[
rid
]
if
!
ok
{
t
.
Fatal
(
"Should have found a tracked round"
)
if
ok
{
t
.
Fatal
(
"Should
not
have found a tracked round"
)
}
if
len
(
trackedRound
)
!=
1
{
if
len
(
trackedRound
)
!=
0
{
t
.
Fatal
(
"Did not find expected number of trackedRounds"
)
}
if
trackedRound
[
0
]
.
MsgID
!=
mid
{
t
.
Fatalf
(
"Did not find expected message ID in trackedRounds"
)
}
trackedMsg
,
ok
:
=
st
.
byMessageID
[
mid
]
if
!
ok
{
t
.
Error
(
"Should have found tracked message"
)
_
,
ok
=
st
.
byMessageID
[
mid
]
if
ok
{
t
.
Error
(
"Should
not
have found tracked message"
)
}
if
trackedMsg
.
MsgID
!=
mid
{
t
.
Fatalf
(
"Did not find expected message ID in byMessageID"
)
_
,
ok
=
st
.
unsent
[
uuid
]
if
ok
{
t
.
Fatal
(
"Should not have found an unsent"
)
}
}
...
...
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
sign in
to comment