From a51d2f47af7674fef8c97aac631608daee675ae6 Mon Sep 17 00:00:00 2001
From: akwizgran <akwizgran@users.sourceforge.net>
Date: Mon, 1 Aug 2016 18:49:24 +0100
Subject: [PATCH] Send messages in ascending order of timestamp.

The old behaviour was a leftover from the days of limited retention periods. The new behaviour will interact better with dependencies and message queues.
---
 briar-core/src/org/briarproject/db/JdbcDatabase.java | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/briar-core/src/org/briarproject/db/JdbcDatabase.java b/briar-core/src/org/briarproject/db/JdbcDatabase.java
index 363075dfd6..4a5cd78cd0 100644
--- a/briar-core/src/org/briarproject/db/JdbcDatabase.java
+++ b/briar-core/src/org/briarproject/db/JdbcDatabase.java
@@ -1532,7 +1532,7 @@ abstract class JdbcDatabase implements Database<Connection> {
 					+ " AND state = ? AND shared = TRUE AND raw IS NOT NULL"
 					+ " AND seen = FALSE AND requested = FALSE"
 					+ " AND expiry < ?"
-					+ " ORDER BY timestamp DESC LIMIT ?";
+					+ " ORDER BY timestamp LIMIT ?";
 			ps = txn.prepareStatement(sql);
 			ps.setInt(1, c.getInt());
 			ps.setInt(2, DELIVERED.getValue());
@@ -1588,7 +1588,7 @@ abstract class JdbcDatabase implements Database<Connection> {
 					+ " AND state = ? AND shared = TRUE AND raw IS NOT NULL"
 					+ " AND seen = FALSE"
 					+ " AND expiry < ?"
-					+ " ORDER BY timestamp DESC";
+					+ " ORDER BY timestamp";
 			ps = txn.prepareStatement(sql);
 			ps.setInt(1, c.getInt());
 			ps.setInt(2, DELIVERED.getValue());
@@ -1686,7 +1686,7 @@ abstract class JdbcDatabase implements Database<Connection> {
 					+ " AND state = ? AND shared = TRUE AND raw IS NOT NULL"
 					+ " AND seen = FALSE AND requested = TRUE"
 					+ " AND expiry < ?"
-					+ " ORDER BY timestamp DESC";
+					+ " ORDER BY timestamp";
 			ps = txn.prepareStatement(sql);
 			ps.setInt(1, c.getInt());
 			ps.setInt(2, DELIVERED.getValue());
-- 
GitLab