Commit Graph

2057 Commits

Author SHA1 Message Date
akwizgran
9fbebe2226 Merge branch '272-message-queue-flow-control' into 'master'
Save queue state before delivering message. #272

Another attempt to fix #272...

See merge request !125
2016-03-30 16:35:36 +00:00
akwizgran
89d25d35d2 Save queue state before delivering message. #272 2016-03-30 17:15:45 +01:00
akwizgran
eeaa7e3813 Merge branch '272-transaction-isolation' into 'master'
Transaction isolation. #272

When client transactions were implemented the DB's read-write lock was removed, exposing H2's transaction isolation semantics. The default isolation level is "read committed", which allows concurrent transactions to overwrite each other's updates. This was the cause of #272. Changing H2's isolation level to "serialisable" would have caused other problems.

The solution is to reintroduce the DB's read-write lock. The lock is acquired when starting a transaction and released when committing or rolling back a transaction. (We already use try/finally blocks to ensure every transaction is committed or rolled back.) Read-only transactions can share the lock. To avoid deadlock, transactions must not be started while holding other locks.

This patch adapts the key manager to the new locking rules. The rest of the code was already compliant. Transports are now added to the DB during the startup phase, which allows TransportAddedEvent and TransportRemovedEvent to be deleted.

Fixes #269, fixes #272.

See merge request !124
2016-03-30 09:40:33 +00:00
akwizgran
1cdba02752 Updated javadocs for database methods. 2016-03-29 16:10:40 +01:00
akwizgran
e58ca00979 Don't start transactions while holding locks. #272 2016-03-29 15:21:46 +01:00
akwizgran
685a864b43 Unit tests for transaction isolation. #272 2016-03-28 13:52:54 +01:00
akwizgran
1855dbbd2d Use a lock to ensure transaction isolation. #272 2016-03-28 13:52:12 +01:00
akwizgran
9714713d73 Add transports to DB during startup. #269 2016-03-28 13:47:23 +01:00
akwizgran
0417639410 Merge duplex and simplex plugin config classes. 2016-03-28 11:28:46 +01:00
akwizgran
65316414ea Added toString() method to TransportId. 2016-03-22 16:07:20 +00:00
akwizgran
31f6c0bf50 More logging for MessageQueueManagerImpl. #272 2016-03-22 13:46:27 +00:00
akwizgran
f20a1e8dfe Fix merge problems in TransportPropertyValidatorTest. 2016-03-16 15:37:54 +00:00
akwizgran
89ca0e5a26 Merge branch 'property-validator-test' into 'master'
TransportPropertyValidatorTest

Tests for the TransportPropertyValidator ValidateMessage call.

See merge request !110
2016-03-16 14:53:00 +00:00
akwizgran
e39a74bd40 Finish SplashScreenActivity when starting next activity.
Fixes #270.
2016-03-15 20:58:57 +00:00
akwizgran
d605e1cae4 Reverted text colour to black.
@color/briar_text_primary is used in a lot of places other than the settings screen - if we want to use grey text in the settings screen we'll need to find another way.

Also fixed some misspelled resource names and included the colours from the Briar palette in color.xml.
2016-03-15 20:46:24 +00:00
akwizgran
3d57516258 Fixed merge issues. 2016-03-15 20:26:50 +00:00
akwizgran
c2a1cc1e4e Merge branch '247-dagger-2' into 'master'
247 dagger 2

This MR in a nutshell replaces Guice and Roboguice with Dagger 2, which offers a lot more possibilities than is implemented in this branch, such as using lazy injections for performance purposes. With Dagger 2 all the magic happens at compile time, so no need to worry about unfulfilled injections at runtime, but due to restrictions I was forced to put injected test code into an Android module. We therefore have a new test module, `android-test`.

A consequence of using Dagger 2 is that we no longer have a view injector and I therefore had to replace those with manual references. 

Closes #247 

See merge request !118
2016-03-15 20:02:14 +00:00
Ernir Erlingsson
11bfa212cc minor tweaks 2016-03-14 21:02:51 +01:00
Ernir Erlingsson
85c66417b5 branch cleanup 2016-03-14 21:02:51 +01:00
Ernir Erlingsson
686729b045 refactor with master and fixed files that were accidentally clobbered 2016-03-14 21:02:51 +01:00
Ernir Erlingsson
4da63b3800 Modified the project structure, removed module extension and went instead for a non-complete core dependency graph 2016-03-14 21:02:51 +01:00
Ernir Erlingsson
7670bc48ea Removed unecessary module 2016-03-14 21:02:51 +01:00
Ernir Erlingsson
6f233070fe Semi-encapsulated the core/api dependency graphs and created a proper structure to load eager singletons 2016-03-14 21:02:51 +01:00
Ernir Erlingsson
10764d727b rebased with master 2016-03-14 21:02:51 +01:00
Ernir Erlingsson
9af3ce123a Added eager singletons and made some fixes 2016-03-14 21:02:51 +01:00
Ernir Erlingsson
5aba1d79f1 Fixes after comments, also removed the CryptoComoponent from the IdentIcons 2016-03-14 21:02:51 +01:00
Ernir Erlingsson
95d89553d5 merged with master 2016-03-14 21:02:51 +01:00
Ernir Erlingsson
ac5d68df81 Added dependency verifications and removed Splash header 2016-03-14 21:01:21 +01:00
Ernir Erlingsson
25324697ac cleanup and added missing desktop modules 2016-03-14 21:01:21 +01:00
Ernir Erlingsson
1be400eb84 Switched Roboguice/Guice out for Dagger 2 2016-03-14 21:01:21 +01:00
akwizgran
e5d7038195 Merge branch '206-settings-prefs-alt' into 'master'
Material design settings - alternative

Closes #206.

Alternative to !77 that does not rely on an additional external library. The two alternatives should be compared for backwards-compatibility specifically regarding the ringtone selector.

Includes code from https://github.com/consp1racy/android-support-preference
License: Apache License v2.0

See merge request !78
2016-03-14 16:20:35 +00:00
Torsten Grote
e8ad11210c Merge branch '266-message-queues' into 'master'
Message queues. #266

A message queue is a group shared by two devices that delivers messages from each device to the other in order. The first 64 bits of the message body contain a sequence number that's incremented for each message sent in a given direction. The incoming and outgoing sequence numbers and information about any messages received out of order and waiting to be delivered are stored in the group metadata.

See merge request !121
2016-03-14 14:56:43 +00:00
Santiago Torres
24f733ed05 WIP: Adds Transport properly validator test 2016-03-13 20:42:09 -04:00
str4d
770d9ddc5f Migrate settings to PreferenceFragmentCompat
Includes code from https://github.com/consp1racy/android-support-preference
License: Apache License v2.0
2016-03-11 21:06:06 +00:00
akwizgran
02eca8ec38 Unit tests for MessageQueueManagerImpl. 2016-03-11 17:18:10 +00:00
akwizgran
e458853f34 Extra logging to track down Tor connection problems. 2016-03-11 15:21:26 +00:00
akwizgran
4afcf2e4a4 Added logging to track down deletion bug. 2016-03-11 10:13:35 +00:00
akwizgran
c615dd1ed1 Merge branch 'bluetooth-race' into 'master'
Fix race condition when closing redundant Bluetooth sockets

The Bluetooth invitation code has a race condition: if Alice and Bob connect to each other at roughly the same time, they each consider their outgoing socket to be redundant and close it, resulting in both sockets being closed. This can be triggered pretty reliably by using two phones of the same model and pressing 'Continue' at the same time on both phones.

When more than one invitation socket is opened, Alice should pick which one to use and Bob should use whichever one Alice picks, which Bob can detect by trying to read from both sockets.

Hopefully the Bluetooth invitation code will be retired when #117 is merged, but I'm putting this up for review in case we need to keep Bluetooth as a fallback method.

See merge request !120
2016-03-09 10:12:05 +00:00
akwizgran
5bb8e95b26 Pass original message to BDF validators and hooks. 2016-03-08 17:03:22 +00:00
akwizgran
9e40d0be16 Added placeholder for MessageQueueManagerImpl tests. 2016-03-08 16:28:31 +00:00
akwizgran
efa06527c9 Moved validation interfaces into respective managers. 2016-03-08 16:22:09 +00:00
akwizgran
d308a30d05 Added BdfIncomingMessageHook. 2016-03-08 16:07:36 +00:00
akwizgran
ab7cc13014 Added QueueMessage support to BdfMessageValidator. 2016-03-08 16:07:36 +00:00
akwizgran
a4d6de0340 Added message queue manager. 2016-03-08 16:07:29 +00:00
akwizgran
c8fed348f0 Merge branch '263-delete-all-the-things' into 'master'
Delete all app data when deleting account. #263

When deleting the user's account, delete everything in the app's persistent storage directory except the libs directory, which is populated with native libs when the app is installed.

Fixes #263.

See merge request !119
2016-03-08 09:37:24 +00:00
akwizgran
c9276de399 Renamed validation hooks to incoming message hooks. 2016-03-07 18:36:30 +00:00
Torsten Grote
8960644273 Merge branch 'use-client-helper' into 'master'
Use client helper in existing clients

Use the new ClientHelper to reduce boilerplate in existing clients. Add a BdfMessageValidator superclass for clients that format their messages as BDF lists and their metadata as BDF dictionaries (which all existing clients do).

See merge request !115
2016-03-07 14:47:32 +00:00
akwizgran
fe9c3adc64 Raise interrupt flag when catching InterruptedException. 2016-03-07 12:17:00 +00:00
akwizgran
0ac67239e3 Fixed race condition when closing redundant sockets.
When more than one invitation socket is opened, Alice should pick which one to use and Bob should use whichever one Alice picks. This fixes a race condition where each party picked a different socket and closed the other.
2016-03-07 11:50:47 +00:00
akwizgran
88ab694af8 No need to unwrap Bytes before adding to dictionary. 2016-03-04 21:11:25 +00:00