Commit 2e2eba82 authored by akwizgran's avatar akwizgran

Handle exceptions thrown by connections' dispose() methods.

parent 0fa945a7
......@@ -88,7 +88,11 @@ class IncomingSimplexConnection {
transport.dispose(false, true);
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
transport.dispose(true, true);
try {
transport.dispose(true, true);
} catch(IOException e1) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
} finally {
connRegistry.unregisterConnection(contactId, transportId);
}
......
......@@ -28,7 +28,7 @@ import net.sf.briar.api.transport.ConnectionWriterFactory;
class OutgoingSimplexConnection {
private static final Logger LOG =
Logger.getLogger(OutgoingSimplexConnection.class.getName());
Logger.getLogger(OutgoingSimplexConnection.class.getName());
private final DatabaseComponent db;
private final ConnectionRegistry connRegistry;
......@@ -103,10 +103,18 @@ class OutgoingSimplexConnection {
transport.dispose(false);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
transport.dispose(true);
try {
transport.dispose(true);
} catch(IOException e1) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
transport.dispose(true);
try {
transport.dispose(true);
} catch(IOException e1) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
} finally {
connRegistry.unregisterConnection(contactId, transportId);
}
......
......@@ -27,7 +27,7 @@ import com.google.inject.Inject;
class ConnectionDispatcherImpl implements ConnectionDispatcher {
private static final Logger LOG =
Logger.getLogger(ConnectionDispatcherImpl.class.getName());
Logger.getLogger(ConnectionDispatcherImpl.class.getName());
private final Executor connExecutor;
private final ConnectionRecogniser recogniser;
......@@ -96,10 +96,18 @@ class ConnectionDispatcherImpl implements ConnectionDispatcher {
transport);
} catch(DbException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
transport.dispose(true, false);
try {
transport.dispose(true, false);
} catch(IOException e1) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
} catch(IOException e) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
transport.dispose(true, false);
try {
transport.dispose(true, false);
} catch(IOException e1) {
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.toString());
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment