mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-19 06:09:55 +01:00
Removed the DB listener when the connection is closed.
This commit is contained in:
@@ -184,10 +184,9 @@ abstract class StreamConnection implements DatabaseListener {
|
|||||||
|
|
||||||
void write() {
|
void write() {
|
||||||
try {
|
try {
|
||||||
|
db.addListener(this);
|
||||||
OutputStream out = createConnectionWriter().getOutputStream();
|
OutputStream out = createConnectionWriter().getOutputStream();
|
||||||
writer = protoWriterFactory.createProtocolWriter(out);
|
writer = protoWriterFactory.createProtocolWriter(out);
|
||||||
// Start receiving database events
|
|
||||||
db.addListener(this);
|
|
||||||
// Send the initial packets: transports, subs, acks, offer
|
// Send the initial packets: transports, subs, acks, offer
|
||||||
dbExecutor.execute(new GenerateTransportUpdate());
|
dbExecutor.execute(new GenerateTransportUpdate());
|
||||||
dbExecutor.execute(new GenerateSubscriptionUpdate());
|
dbExecutor.execute(new GenerateSubscriptionUpdate());
|
||||||
@@ -215,6 +214,8 @@ abstract class StreamConnection implements DatabaseListener {
|
|||||||
} catch(IOException e) {
|
} catch(IOException e) {
|
||||||
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
|
if(LOG.isLoggable(Level.WARNING)) LOG.warning(e.getMessage());
|
||||||
transport.dispose(false);
|
transport.dispose(false);
|
||||||
|
} finally {
|
||||||
|
db.removeListener(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user