Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
briar
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
694
Issues
694
List
Boards
Labels
Service Desk
Milestones
Merge Requests
15
Merge Requests
15
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
briar
briar
Commits
99edb893
Verified
Commit
99edb893
authored
May 08, 2020
by
akwizgran
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check for stability whenever connections are closed.
parent
f063feed
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
6 deletions
+10
-6
bramble-core/src/main/java/org/briarproject/bramble/plugin/bluetooth/BluetoothConnectionLimiterImpl.java
...mble/plugin/bluetooth/BluetoothConnectionLimiterImpl.java
+10
-6
No files found.
bramble-core/src/main/java/org/briarproject/bramble/plugin/bluetooth/BluetoothConnectionLimiterImpl.java
View file @
99edb893
...
...
@@ -113,14 +113,18 @@ class BluetoothConnectionLimiterImpl implements BluetoothConnectionLimiter {
public
void
connectionClosed
(
DuplexTransportConnection
conn
,
boolean
exception
)
{
synchronized
(
lock
)
{
int
numConnections
=
connections
.
size
();
Iterator
<
ConnectionRecord
>
it
=
connections
.
iterator
();
while
(
it
.
hasNext
())
{
if
(
it
.
next
().
connection
==
conn
)
{
it
.
remove
();
if
(
exception
&&
numConnections
>
connectionLimit
)
{
connectionFailedAboveLimit
();
long
now
=
clock
.
currentTimeMillis
();
if
(
exception
)
{
if
(
connections
.
size
()
>
connectionLimit
)
{
connectionFailedAboveLimit
(
now
);
}
}
else
{
considerRaisingConnectionLimit
(
now
);
}
it
.
remove
();
break
;
}
}
...
...
@@ -132,6 +136,7 @@ class BluetoothConnectionLimiterImpl implements BluetoothConnectionLimiter {
@Override
public
void
bluetoothDisabled
()
{
synchronized
(
lock
)
{
considerRaisingConnectionLimit
(
clock
.
currentTimeMillis
());
connections
.
clear
();
LOG
.
info
(
"Bluetooth disabled"
);
}
...
...
@@ -173,8 +178,7 @@ class BluetoothConnectionLimiterImpl implements BluetoothConnectionLimiter {
}
@GuardedBy
(
"lock"
)
private
void
connectionFailedAboveLimit
()
{
long
now
=
clock
.
currentTimeMillis
();
private
void
connectionFailedAboveLimit
(
long
now
)
{
if
(
now
-
timeOfLastAttempt
<
STABILITY_PERIOD_MS
)
{
LOG
.
info
(
"Connection failed above limit, increasing interval"
);
attemptInterval
=
min
(
attemptInterval
*
2
,
MAX_ATTEMPT_INTERVAL_MS
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment