mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-20 14:49:53 +01:00
Ensure semaphore is released if an exception is thrown.
This commit is contained in:
@@ -72,9 +72,10 @@ class IncomingBatchConnection {
|
||||
} catch(DbException e) {
|
||||
if(LOG.isLoggable(Level.WARNING))
|
||||
LOG.warning(e.getMessage());
|
||||
}
|
||||
} finally {
|
||||
semaphore.release();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if(proto.hasBatch()) {
|
||||
final UnverifiedBatch b = proto.readBatch();
|
||||
@@ -90,9 +91,10 @@ class IncomingBatchConnection {
|
||||
} catch(GeneralSecurityException e) {
|
||||
if(LOG.isLoggable(Level.WARNING))
|
||||
LOG.warning(e.getMessage());
|
||||
}
|
||||
} finally {
|
||||
semaphore.release();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if(proto.hasSubscriptionUpdate()) {
|
||||
final SubscriptionUpdate s = proto.readSubscriptionUpdate();
|
||||
@@ -105,9 +107,10 @@ class IncomingBatchConnection {
|
||||
} catch(DbException e) {
|
||||
if(LOG.isLoggable(Level.WARNING))
|
||||
LOG.warning(e.getMessage());
|
||||
}
|
||||
} finally {
|
||||
semaphore.release();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if(proto.hasTransportUpdate()) {
|
||||
final TransportUpdate t = proto.readTransportUpdate();
|
||||
@@ -120,9 +123,10 @@ class IncomingBatchConnection {
|
||||
} catch(DbException e) {
|
||||
if(LOG.isLoggable(Level.WARNING))
|
||||
LOG.warning(e.getMessage());
|
||||
}
|
||||
} finally {
|
||||
semaphore.release();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
throw new FormatException();
|
||||
|
||||
@@ -140,9 +140,10 @@ abstract class StreamConnection implements DatabaseListener {
|
||||
} catch(DbException e) {
|
||||
if(LOG.isLoggable(Level.WARNING))
|
||||
LOG.warning(e.getMessage());
|
||||
}
|
||||
} finally {
|
||||
semaphore.release();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if(proto.hasBatch()) {
|
||||
final UnverifiedBatch b = proto.readBatch();
|
||||
@@ -158,9 +159,10 @@ abstract class StreamConnection implements DatabaseListener {
|
||||
} catch(GeneralSecurityException e) {
|
||||
if(LOG.isLoggable(Level.WARNING))
|
||||
LOG.warning(e.getMessage());
|
||||
}
|
||||
} finally {
|
||||
semaphore.release();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if(proto.hasOffer()) {
|
||||
Offer o = proto.readOffer();
|
||||
@@ -200,9 +202,10 @@ abstract class StreamConnection implements DatabaseListener {
|
||||
} catch(DbException e) {
|
||||
if(LOG.isLoggable(Level.WARNING))
|
||||
LOG.warning(e.getMessage());
|
||||
}
|
||||
} finally {
|
||||
semaphore.release();
|
||||
}
|
||||
}
|
||||
});
|
||||
// Store the requested message IDs and notify the writer
|
||||
synchronized(this) {
|
||||
@@ -223,9 +226,10 @@ abstract class StreamConnection implements DatabaseListener {
|
||||
} catch(DbException e) {
|
||||
if(LOG.isLoggable(Level.WARNING))
|
||||
LOG.warning(e.getMessage());
|
||||
}
|
||||
} finally {
|
||||
semaphore.release();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else if(proto.hasTransportUpdate()) {
|
||||
final TransportUpdate t = proto.readTransportUpdate();
|
||||
@@ -238,9 +242,10 @@ abstract class StreamConnection implements DatabaseListener {
|
||||
} catch(DbException e) {
|
||||
if(LOG.isLoggable(Level.WARNING))
|
||||
LOG.warning(e.getMessage());
|
||||
}
|
||||
} finally {
|
||||
semaphore.release();
|
||||
}
|
||||
}
|
||||
});
|
||||
} else {
|
||||
throw new FormatException();
|
||||
|
||||
Reference in New Issue
Block a user