Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
briar
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository 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
Julian Dehm
briar
Commits
9b00a6f0
Commit
9b00a6f0
authored
12 years ago
by
akwizgran
Browse files
Options
Downloads
Patches
Plain Diff
Remove dead secrets from the connection recogniser.
parent
d940c637
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
components/net/sf/briar/transport/KeyManagerImpl.java
+19
-13
19 additions, 13 deletions
components/net/sf/briar/transport/KeyManagerImpl.java
with
19 additions
and
13 deletions
components/net/sf/briar/transport/KeyManagerImpl.java
+
19
−
13
View file @
9b00a6f0
...
...
@@ -76,8 +76,8 @@ class KeyManagerImpl extends TimerTask implements KeyManager, DatabaseListener {
try
{
// Store any secrets that have been created
if
(!
created
.
isEmpty
())
db
.
addSecrets
(
created
);
// Pass the current incoming secrets to the
connection
recogniser
// FIXME: This uses a separate database transaction
for each
secret
// Pass the current incoming secrets to the recogniser
// FIXME: This uses a separate database transaction
per
secret
for
(
TemporarySecret
s
:
incomingOld
.
values
())
recogniser
.
addSecret
(
s
);
for
(
TemporarySecret
s
:
incomingNew
.
values
())
...
...
@@ -237,19 +237,25 @@ class KeyManagerImpl extends TimerTask implements KeyManager, DatabaseListener {
// Work out what phase of its lifecycle each secret is in
long
now
=
System
.
currentTimeMillis
();
Collection
<
TemporarySecret
>
dead
=
assignSecretsToMaps
(
now
,
secrets
);
// Remove any dead secrets from the recogniser
for
(
TemporarySecret
s
:
dead
)
{
ContactId
c
=
s
.
getContactId
();
TransportId
t
=
s
.
getTransportId
();
long
period
=
s
.
getPeriod
();
recogniser
.
removeSecret
(
c
,
t
,
period
);
}
// Replace any dead secrets
Collection
<
TemporarySecret
>
created
=
replaceDeadSecrets
(
now
,
dead
);
try
{
// Store any secrets that have been created
if
(!
created
.
isEmpty
())
db
.
addSecrets
(
created
);
// Pass the current incoming secrets to the connection recogniser
// FIXME: This uses a separate database transaction for each secret
for
(
TemporarySecret
s
:
incomingOld
.
values
())
recogniser
.
addSecret
(
s
);
for
(
TemporarySecret
s
:
incomingNew
.
values
())
recogniser
.
addSecret
(
s
);
}
catch
(
DbException
e
)
{
if
(
LOG
.
isLoggable
(
Level
.
WARNING
))
LOG
.
warning
(
e
.
toString
());
if
(!
created
.
isEmpty
())
{
try
{
// Store any secrets that have been created
db
.
addSecrets
(
created
);
// Pass any secrets that have been created to the recogniser
// FIXME: This uses a separate database transaction per secret
for
(
TemporarySecret
s
:
created
)
recogniser
.
addSecret
(
s
);
}
catch
(
DbException
e
)
{
if
(
LOG
.
isLoggable
(
Level
.
WARNING
))
LOG
.
warning
(
e
.
toString
());
}
}
}
...
...
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