mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-12 10:49:06 +01:00
Merge branch '1758-release-timeout-monitor-resources' into 'master'
Ensure TimeoutInputStreams are closed Closes #1758 See merge request briar/briar!1273
This commit is contained in:
@@ -55,6 +55,7 @@ class AndroidBluetoothTransportConnection
|
||||
protected void closeConnection(boolean exception) throws IOException {
|
||||
try {
|
||||
socket.close();
|
||||
in.close();
|
||||
} finally {
|
||||
wakeLock.release();
|
||||
connectionLimiter.connectionClosed(this);
|
||||
|
||||
@@ -7,6 +7,10 @@ public interface TimeoutMonitor {
|
||||
/**
|
||||
* Returns an {@link InputStream} that wraps the given stream and allows
|
||||
* read timeouts to be detected.
|
||||
* <p>
|
||||
* The returned stream must be {@link InputStream#close() closed} when it's
|
||||
* no longer needed to ensure that resources held by the timeout monitor
|
||||
* are released.
|
||||
*
|
||||
* @param timeoutMs The read timeout in milliseconds. Timeouts will be
|
||||
* detected eventually but are not guaranteed to be detected immediately.
|
||||
|
||||
@@ -46,6 +46,7 @@ class JavaBluetoothTransportConnection
|
||||
protected void closeConnection(boolean exception) throws IOException {
|
||||
try {
|
||||
socket.close();
|
||||
in.close();
|
||||
} finally {
|
||||
connectionLimiter.connectionClosed(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user