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
e259a727
Commit
e259a727
authored
3 years ago
by
Josh Brooks
Browse files
Options
Downloads
Patches
Plain Diff
Fix spamming ignoring identity print
parent
6b713cc0
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!510
Release
,
!207
WIP: Client Restructure
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cmix/identity/tracker.go
+16
-9
16 additions, 9 deletions
cmix/identity/tracker.go
with
16 additions
and
9 deletions
cmix/identity/tracker.go
+
16
−
9
View file @
e259a727
...
@@ -180,16 +180,19 @@ func (t *manager) track(stop *stoppable.Single) {
...
@@ -180,16 +180,19 @@ func (t *manager) track(stop *stoppable.Single) {
for
{
for
{
// Process new and old identities
// Process new and old identities
nextEvent
:=
t
.
processIdentities
(
addressSize
)
nextEvent
:=
t
.
processIdentities
(
addressSize
)
waitPeriod
:=
nextEvent
.
Sub
(
netTime
.
Now
())
// Trigger events early. This will cause generations to happen early as
// well as message pickup. As a result, if there are time sync issues
if
waitPeriod
>
validityGracePeriod
{
// between clients, and they begin sending to ephemeral IDs early, then
// Trigger events early. This will cause generations to happen early as
// messages will still be picked up.
// well as message pickup. As a result, if there are time sync issues
nextUpdate
:=
nextEvent
.
Add
(
-
validityGracePeriod
)
// between clients, and they begin sending to ephemeral IDs early, then
// messages will still be picked up.
waitPeriod
=
waitPeriod
-
validityGracePeriod
}
// Sleep until the last ID has expired
// Sleep until the last ID has expired
select
{
select
{
case
<-
time
.
After
(
nextUpdate
.
Sub
(
nextUpdate
)
)
:
case
<-
time
.
After
(
waitPeriod
)
:
case
newIdentity
:=
<-
t
.
newIdentity
:
case
newIdentity
:=
<-
t
.
newIdentity
:
jww
.
DEBUG
.
Printf
(
"Receiving new identity %s :%+v"
,
jww
.
DEBUG
.
Printf
(
"Receiving new identity %s :%+v"
,
newIdentity
.
Source
,
newIdentity
)
newIdentity
.
Source
,
newIdentity
)
...
@@ -240,7 +243,9 @@ func (t *manager) track(stop *stoppable.Single) {
...
@@ -240,7 +243,9 @@ func (t *manager) track(stop *stoppable.Single) {
func
(
t
*
manager
)
processIdentities
(
addressSize
uint8
)
time
.
Time
{
func
(
t
*
manager
)
processIdentities
(
addressSize
uint8
)
time
.
Time
{
edits
:=
false
edits
:=
false
toRemove
:=
make
(
map
[
int
]
struct
{})
toRemove
:=
make
(
map
[
int
]
struct
{})
nextEvent
:=
t
.
tracked
[
0
]
.
ValidUntil
// Identities are rotated on a 24-hour time period. Set the event
// to the latest possible time so that any sooner times will overwrite this
nextEvent
:=
netTime
.
Now
()
.
Add
(
time
.
Duration
(
ephemeral
.
Period
))
// Loop through every tracked ID and see if any operations are needed
// Loop through every tracked ID and see if any operations are needed
for
i
,
inQuestion
:=
range
t
.
tracked
{
for
i
,
inQuestion
:=
range
t
.
tracked
{
...
@@ -263,13 +268,15 @@ func (t *manager) processIdentities(addressSize uint8) time.Time {
...
@@ -263,13 +268,15 @@ func (t *manager) processIdentities(addressSize uint8) time.Time {
if
inQuestion
.
NextGeneration
.
Before
(
nextEvent
)
{
if
inQuestion
.
NextGeneration
.
Before
(
nextEvent
)
{
nextEvent
=
inQuestion
.
NextGeneration
nextEvent
=
inQuestion
.
NextGeneration
}
}
if
inQuestion
.
ValidUntil
.
Before
(
nextEvent
)
{
if
!
inQuestion
.
ValidUntil
.
IsZero
()
&&
inQuestion
.
ValidUntil
.
Before
(
nextEvent
)
{
nextEvent
=
inQuestion
.
ValidUntil
nextEvent
=
inQuestion
.
ValidUntil
}
}
}
}
}
}
jww
.
DEBUG
.
Printf
(
"[TrackedIDS] NextEvent: %s"
,
nextEvent
)
// Process any deletions
// Process any deletions
if
len
(
toRemove
)
>
0
{
if
len
(
toRemove
)
>
0
{
newTracked
:=
make
([]
TrackedID
,
0
,
len
(
t
.
tracked
))
newTracked
:=
make
([]
TrackedID
,
0
,
len
(
t
.
tracked
))
...
...
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