Commit Graph

4188 Commits

Author SHA1 Message Date
akwizgran a8b96f11fd Added Consumer support to Writer, to avoid redundant copying. 2011-09-28 18:47:24 +01:00
akwizgran 9c2e3917bf Added an integration test for batch transports. 2011-09-28 14:43:23 +01:00
akwizgran a1b664b639 More refactoring to connect ConnectionRecogniser to ConnectionReader.
Added TestDatabaseModule so tests can specify their own DB
configuration. The modules are currently too tightly coupled - see
whether any dependencies can be removed.
2011-09-28 14:21:38 +01:00
akwizgran 4aff0c4f88 Refactored transport component and renamed WritersModule.
The goal of the refactoring was to clean up the dependencies of
IncomingBatchConnection and OutgoingBatchConnection.
2011-09-27 19:21:44 +01:00
akwizgran 6ed8d89e59 Don't block when free disk space is critically low.
If it's not possible to free up any additional space, exit rather than
hanging. In future we should warn the user before exiting.
2011-09-27 17:05:51 +01:00
akwizgran 90e32ac906 AtomicBoolean is not needed. 2011-09-27 16:29:41 +01:00
akwizgran dea77b22d7 Don't call stopped.get() outside the lock. 2011-09-27 16:26:55 +01:00
akwizgran a40c081815 Record when the latest subscription/transport update was sent. 2011-09-26 18:13:48 +01:00
akwizgran 266048a815 Removed an unused method. 2011-09-26 18:03:02 +01:00
akwizgran 53b5a61ab3 Replaced Database.getParent() with getGroupMessageParent().
The new method checks whether the parent is present in the database
and belongs to the same group, so separate methods for those checks
have been removed.
2011-09-26 18:00:56 +01:00
akwizgran 124188a0a1 DatabaseComponent.setSeen() should call setStatusSeenIfVisible().
Otherwise an exception may be thrown if an offered message is no
longer in the DB.
2011-09-25 14:39:31 +01:00
akwizgran 98ab523092 Database refactoring to fix injection problems. 2011-09-23 18:52:56 +01:00
akwizgran 4b0e91f52c Removed test classes' dependency on ByteArray{Input,Output)Stream. 2011-09-23 16:36:07 +01:00
akwizgran 2a92ed0056 Removed fake database password from Guice module. 2011-09-23 16:25:48 +01:00
akwizgran b470afb4ef Added DatabaseComponent.setSeen() for handling requests.
Also moved IO out of the lock in receiveOffer().
2011-09-23 16:06:14 +01:00
akwizgran ba1c61810d Updated the visibility criteria of setStatusSeenIfVisible(). 2011-09-23 16:04:58 +01:00
akwizgran 7c6e0c349c Extracted constants from DatabaseComponent interface. 2011-09-23 15:33:41 +01:00
akwizgran b675c38953 Don't do IO while holding database locks. 2011-09-23 12:55:23 +01:00
akwizgran 09971c8460 Implemented incoming and outgoing batch connections (untested). 2011-09-22 16:26:06 +01:00
akwizgran b65d6631f1 Removed writer's count of bytes written and renamed a method. 2011-09-21 18:22:14 +01:00
akwizgran 52f3b70c3f Added size-unlimited version of Database.getSendableMessages(). 2011-09-21 18:10:22 +01:00
akwizgran eba6884281 Javadocs. 2011-09-21 18:09:56 +01:00
akwizgran e589d44d9f Where possible, do IO outside transactions and locks. 2011-09-21 18:04:21 +01:00
akwizgran 43a6a22f4a Don't call finish() unless at least one message ID was written. 2011-09-21 17:52:34 +01:00
akwizgran 8dd7ec93e7 DatabaseComponent.generateAck() now returns a boolean.
The return value indicates whether any batch IDs were written.
AckWriter.finish() and Database.removeBatchesToAck() are only called
if at least one batch ID was written.
2011-09-21 17:51:17 +01:00
akwizgran fadd95ae49 Added a test for MAX_PACKET_LENGTH. 2011-09-21 15:56:50 +01:00
akwizgran 10c3b21726 Expose the encryption and authentication overhead without breaking
encapsulation.

This should allow callers to calculate maximum packet sizes without
knowing the details of the transport protocol.
2011-09-21 15:22:25 +01:00
akwizgran 7e58b25618 Allow the max packet length to be reduced from the default. 2011-09-21 13:47:06 +01:00
akwizgran 77d61e0aea Don't create empty packets. 2011-09-21 13:30:04 +01:00
akwizgran 3e60233ae0 Expose serialisation overhead without breaking encapsulation. 2011-09-21 13:16:58 +01:00
akwizgran 95c3fb4fed Removed getCapacity() from BatchWriter interface. 2011-09-21 12:37:19 +01:00
akwizgran 7ac615520b Moved tag definitions inside serial component. 2011-09-21 12:08:27 +01:00
akwizgran 5548eb32cd DatabaseComponent.generateBatch() now returns a boolean.
This allows a connection to know whether to try writing another batch
immediately, or to wait for an event from the DB.
2011-09-20 14:45:07 +01:00
akwizgran 75446b7f7e Collapsed ack handling into a single transaction.
The locks were being held across all transactions anyway, so there was
no granularity advantage to using multiple transactions.
2011-09-19 18:51:27 +01:00
akwizgran 3dd3742a96 Folded findLostBatches() into receiveAck(). 2011-09-19 18:45:19 +01:00
akwizgran 7aeb6029a6 Assertions and comments. 2011-09-19 16:42:27 +01:00
akwizgran 4b97be897e Don't attempt to retrieve ratings for anonymous messages. 2011-09-19 16:25:49 +01:00
akwizgran 44c8f9ceaa Folded ReadWriteLockDatabaseComponent into its parent. 2011-09-19 15:29:40 +01:00
akwizgran 7ef44fbab1 Updated javadoc and renamed type parameters. 2011-09-19 15:01:55 +01:00
akwizgran bf01dd4f96 Folded ReadWriteLockDatabaseComponentTest into its parent. 2011-09-19 14:58:32 +01:00
akwizgran 22b8321376 Removed SynchronizedDatabaseComponent.
LockFairnessTest passes on Windows, Mac and Linux, so it's safe to use
ReadWriteLockDatabaseComponent on all those platforms. We can revisit
this issue for Android if necessary, but for now it's a waste of
effort to have two parallel implementations.
2011-09-19 14:54:29 +01:00
akwizgran f6e5ef415a BadPaddingExceptions should be rethrown as RuntimeExceptions. 2011-09-19 14:53:44 +01:00
akwizgran 11cf84dedc Arrays.copyOfRange() is not available in Java 5. 2011-09-19 14:53:12 +01:00
akwizgran 7cdca62063 IOException(Throwable) constructor isn't available in Java 5. 2011-09-19 14:49:27 +01:00
akwizgran fde354957c Timestamps may not be negative. 2011-09-16 13:20:49 +01:00
akwizgran 53f02f7a52 Fixed unit tests for database component. 2011-09-16 13:13:27 +01:00
akwizgran ad1ef4461f SynchronizedDatabaseComponent.addLocalPrivateMessage() was not
checking whether the contact was still in the DB.
2011-09-16 13:11:20 +01:00
akwizgran f18c86b0d3 Unit tests for private messages. 2011-09-16 13:06:04 +01:00
akwizgran 43a59d9dbe Database.hasSendableMessages() should check for private messages. 2011-09-16 12:55:57 +01:00
akwizgran 5f05a7f898 Unit tests for private messages. 2011-09-16 11:33:55 +01:00