mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-11 18:29:05 +01:00
Order sendable messages by timestamp. Also fixed some comments.
This commit is contained in:
@@ -4,7 +4,7 @@ import java.io.IOException;
|
||||
|
||||
import net.sf.briar.api.protocol.BatchId;
|
||||
|
||||
/** An interface for creating an ack. */
|
||||
/** An interface for creating an ack packet. */
|
||||
public interface AckWriter {
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,7 @@ import java.io.IOException;
|
||||
|
||||
import net.sf.briar.api.protocol.BatchId;
|
||||
|
||||
/** An interface for creating a batch of messages. */
|
||||
/** An interface for creating a batch packet. */
|
||||
public interface BatchWriter {
|
||||
|
||||
/** Returns the capacity of the batch in bytes. */
|
||||
|
||||
@@ -5,7 +5,7 @@ import java.io.IOException;
|
||||
import net.sf.briar.api.protocol.MessageId;
|
||||
import net.sf.briar.api.protocol.OfferId;
|
||||
|
||||
/** An interface for creating a have notification. */
|
||||
/** An interface for creating an offer packet. */
|
||||
public interface OfferWriter {
|
||||
|
||||
/**
|
||||
|
||||
@@ -1144,8 +1144,8 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
+ " AND visibilities.contactId = ?"
|
||||
+ " AND statuses.contactId = ?"
|
||||
+ " AND timestamp >= start"
|
||||
+ " AND status = ? AND sendability > ZERO()";
|
||||
// FIXME: Investigate the performance impact of "ORDER BY timestamp"
|
||||
+ " AND status = ? AND sendability > ZERO()"
|
||||
+ " ORDER BY timestamp";
|
||||
ps = txn.prepareStatement(sql);
|
||||
ps.setInt(1, c.getInt());
|
||||
ps.setInt(2, c.getInt());
|
||||
@@ -1162,11 +1162,9 @@ abstract class JdbcDatabase implements Database<Connection> {
|
||||
}
|
||||
rs.close();
|
||||
ps.close();
|
||||
if(!ids.isEmpty()) {
|
||||
if(LOG.isLoggable(Level.FINE))
|
||||
LOG.fine(ids.size() + " sendable messages, " + total
|
||||
+ " bytes");
|
||||
}
|
||||
if(LOG.isLoggable(Level.FINE))
|
||||
LOG.fine(ids.size() + " sendable messages, " + total + "/" +
|
||||
capacity + " bytes");
|
||||
return ids;
|
||||
} catch(SQLException e) {
|
||||
tryToClose(rs);
|
||||
|
||||
@@ -68,7 +68,7 @@ public class ConstantsTest extends TestCase {
|
||||
// Check that no more batch IDs can be written
|
||||
assertFalse(a.writeBatchId(new BatchId(TestUtils.getRandomId())));
|
||||
a.finish();
|
||||
// Check the size of the ack
|
||||
// Check the size of the serialised ack
|
||||
assertTrue(out.size() > UniqueId.LENGTH * Ack.MAX_IDS_PER_ACK);
|
||||
assertTrue(out.size() <= ProtocolConstants.MAX_PACKET_LENGTH);
|
||||
}
|
||||
@@ -117,7 +117,7 @@ public class ConstantsTest extends TestCase {
|
||||
// Check that no more message IDs can be written
|
||||
assertFalse(o.writeMessageId(new MessageId(TestUtils.getRandomId())));
|
||||
o.finish();
|
||||
// Check the size of the offer
|
||||
// Check the size of the serialised offer
|
||||
assertTrue(out.size() > UniqueId.LENGTH * Offer.MAX_IDS_PER_OFFER);
|
||||
assertTrue(out.size() <= ProtocolConstants.MAX_PACKET_LENGTH);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user