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
7ed1741d
Commit
7ed1741d
authored
2 years ago
by
benjamin
Browse files
Options
Downloads
Patches
Plain Diff
fixed the random message id creation
parent
7bd7001c
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...
,
!403
make unsent message ids actually random
,
!340
Project/channels
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
channels/sendTracker.go
+19
-20
19 additions, 20 deletions
channels/sendTracker.go
with
19 additions
and
20 deletions
channels/sendTracker.go
+
19
−
20
View file @
7ed1741d
...
...
@@ -205,26 +205,25 @@ func (st *sendTracker) denotePendingSend(channelID *id.ID,
// approximate the lag due to round submission
ts
:=
netTime
.
Now
()
.
Add
(
oneSecond
)
// submit the message to the UI
uuid
,
err
:=
st
.
trigger
(
channelID
,
umi
,
ts
,
receptionID
.
EphemeralIdentity
{},
rounds
.
Round
{},
Unsent
)
if
err
!=
nil
{
return
0
,
err
}
// create a random message id so there will not be collisions in a database
// that requires a unique message ID
stream
:=
st
.
rngSrc
.
GetStream
()
randMid
:=
cryptoChannel
.
MessageID
{}
num
,
err
:=
stream
.
Read
(
randMid
[
:
])
if
num
!=
len
(
randMid
[
:
])
||
err
!=
nil
{
num
,
err
:=
stream
.
Read
(
umi
.
messageID
[
:
])
if
num
!=
len
(
umi
.
messageID
[
:
])
||
err
!=
nil
{
jww
.
FATAL
.
Panicf
(
"failed to get a random message ID, read "
+
"len: %d, err: %+v"
,
num
,
err
)
}
stream
.
Close
()
// submit the message to the UI
uuid
,
err
:=
st
.
trigger
(
channelID
,
umi
,
ts
,
receptionID
.
EphemeralIdentity
{},
rounds
.
Round
{},
Unsent
)
if
err
!=
nil
{
return
0
,
err
}
// track the message on disk
st
.
handleDenoteSend
(
uuid
,
channelID
,
randMid
,
st
.
handleDenoteSend
(
uuid
,
channelID
,
umi
.
messageID
,
rounds
.
Round
{})
return
uuid
,
nil
}
...
...
@@ -237,15 +236,6 @@ func (st *sendTracker) denotePendingAdminSend(channelID *id.ID,
// approximate the lag due to round submission
ts
:=
netTime
.
Now
()
.
Add
(
oneSecond
)
// submit the message to the UI
uuid
,
err
:=
st
.
adminTrigger
(
channelID
,
cm
,
ts
,
cryptoChannel
.
MessageID
{},
receptionID
.
EphemeralIdentity
{},
rounds
.
Round
{},
Unsent
)
if
err
!=
nil
{
return
0
,
err
}
// create a random message id so there will not be collisions in a database
// that requires a unique message ID
stream
:=
st
.
rngSrc
.
GetStream
()
...
...
@@ -257,6 +247,15 @@ func (st *sendTracker) denotePendingAdminSend(channelID *id.ID,
}
stream
.
Close
()
// submit the message to the UI
uuid
,
err
:=
st
.
adminTrigger
(
channelID
,
cm
,
ts
,
randMid
,
receptionID
.
EphemeralIdentity
{},
rounds
.
Round
{},
Unsent
)
if
err
!=
nil
{
return
0
,
err
}
// track the message on disk
st
.
handleDenoteSend
(
uuid
,
channelID
,
randMid
,
rounds
.
Round
{})
...
...
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