Merge branch '2336-get-next-send-time' into 'master'

Consider latency when getting next send time from DB

Closes #2336

See merge request briar/briar!1671
This commit is contained in:
Torsten Grote
2022-06-17 13:14:38 +00:00
6 changed files with 72 additions and 31 deletions

View File

@@ -541,15 +541,18 @@ public interface DatabaseComponent extends TransactionManager {
*/
long getNextCleanupDeadline(Transaction txn) throws DbException;
/*
/**
* Returns the next time (in milliseconds since the Unix epoch) when a
* message is due to be sent to the given contact. The returned value may
* be zero if a message is due to be sent immediately, or Long.MAX_VALUE if
* no messages are scheduled to be sent.
* message is due to be sent to the given contact over a transport with
* the given latency.
* <p>
* The returned value may be zero if a message is due to be sent
* immediately, or Long.MAX_VALUE if no messages are scheduled to be sent.
* <p/>
* Read-only.
*/
long getNextSendTime(Transaction txn, ContactId c) throws DbException;
long getNextSendTime(Transaction txn, ContactId c, long maxLatency)
throws DbException;
/**
* Returns the pending contact with the given ID.