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
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
briar
briar
Commits
173b6006
Verified
Commit
173b6006
authored
May 8, 2020
by
akwizgran
Browse files
Options
Downloads
Patches
Plain Diff
Don't treat an incoming connection as an attempt to raise the limit.
parent
99edb893
No related branches found
No related tags found
No related merge requests found
Pipeline
#4372
passed
May 11, 2020
Stage: test
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
bramble-core/src/main/java/org/briarproject/bramble/plugin/bluetooth/BluetoothConnectionLimiterImpl.java
+8
-12
8 additions, 12 deletions
...mble/plugin/bluetooth/BluetoothConnectionLimiterImpl.java
with
8 additions
and
12 deletions
bramble-core/src/main/java/org/briarproject/bramble/plugin/bluetooth/BluetoothConnectionLimiterImpl.java
+
8
−
12
View file @
173b6006
...
...
@@ -88,7 +88,7 @@ class BluetoothConnectionLimiterImpl implements BluetoothConnectionLimiter {
long
now
=
clock
.
currentTimeMillis
();
if
(
incoming
||
isContactConnectionAllowedByLimit
(
now
))
{
connections
.
add
(
new
ConnectionRecord
(
conn
,
now
));
if
(
connections
.
size
()
>
connectionLimit
)
{
if
(
!
incoming
&&
connections
.
size
()
>
connectionLimit
)
{
LOG
.
info
(
"Attempting to raise connection limit"
);
timeOfLastAttempt
=
now
;
}
...
...
@@ -117,13 +117,8 @@ class BluetoothConnectionLimiterImpl implements BluetoothConnectionLimiter {
while
(
it
.
hasNext
())
{
if
(
it
.
next
().
connection
==
conn
)
{
long
now
=
clock
.
currentTimeMillis
();
if
(
exception
)
{
if
(
connections
.
size
()
>
connectionLimit
)
{
connectionFailedAboveLimit
(
now
);
}
}
else
{
considerRaisingConnectionLimit
(
now
);
}
if
(
exception
)
connectionFailed
(
now
);
else
considerRaisingConnectionLimit
(
now
);
it
.
remove
();
break
;
}
...
...
@@ -136,9 +131,9 @@ class BluetoothConnectionLimiterImpl implements BluetoothConnectionLimiter {
@Override
public
void
bluetoothDisabled
()
{
synchronized
(
lock
)
{
LOG
.
info
(
"Bluetooth disabled"
);
considerRaisingConnectionLimit
(
clock
.
currentTimeMillis
());
connections
.
clear
();
LOG
.
info
(
"Bluetooth disabled"
);
}
}
...
...
@@ -168,7 +163,7 @@ class BluetoothConnectionLimiterImpl implements BluetoothConnectionLimiter {
}
if
(
stable
>
connectionLimit
)
{
LOG
.
info
(
"Raising connection limit"
);
connectionLimit
++
;
connectionLimit
=
stable
;
attemptInterval
=
MIN_ATTEMPT_INTERVAL_MS
;
}
if
(
LOG
.
isLoggable
(
INFO
))
{
...
...
@@ -178,8 +173,9 @@ class BluetoothConnectionLimiterImpl implements BluetoothConnectionLimiter {
}
@GuardedBy
(
"lock"
)
private
void
connectionFailedAboveLimit
(
long
now
)
{
if
(
now
-
timeOfLastAttempt
<
STABILITY_PERIOD_MS
)
{
private
void
connectionFailed
(
long
now
)
{
if
(
connections
.
size
()
>
connectionLimit
&&
now
-
timeOfLastAttempt
<
STABILITY_PERIOD_MS
)
{
LOG
.
info
(
"Connection failed above limit, increasing interval"
);
attemptInterval
=
min
(
attemptInterval
*
2
,
MAX_ATTEMPT_INTERVAL_MS
);
}
...
...
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