Commit Graph

367 Commits

Author SHA1 Message Date
Torsten Grote 823b95f7d6 Add tests for IntroductionManager and Validator 2016-04-14 12:53:23 -03:00
akwizgran 40022b8326 Don't allow local identities to be added as contacts. 2016-04-11 13:24:25 +01:00
akwizgran 3c2378e024 Fixed indentation. 2016-04-06 17:12:27 +01:00
akwizgran 7de83b5624 Removed device ID from transport properties. 2016-04-06 17:12:20 +01:00
akwizgran befd916eba Connect to newly activated contacts. 2016-04-06 17:10:54 +01:00
akwizgran 4e3835d2fe Merge branch 'tests-cleanup' into 'master'
Clean up tests

* Broke up ConstantsTest (#280) - the key encoding parts are now in KeyEncodingAndParsingTest, the message encoding parts are in MessageSizeIntegrationTest
* Renamed the other integration tests in briar-android-tests
* Moved the integration tests in briar-android-tests to the top-level package, as they all involve code from multiple packages
* Separated DatabaseExecutorModule from DatabaseModule so we can use a different @DatabaseExecutor in integration tests
* Merged AppModule with AndroidModule (@ernir, this touches code you're working on but I don't think there are any conflicts)
* Renamed some TestUtils methods for consistency
* Used TestUtils.getRandomBytes() where applicable

Fixes #280.

See merge request !133
2016-04-06 16:03:48 +00:00
akwizgran f7dbfe2551 Renamed a couple of integration tests. 2016-04-06 15:56:34 +01:00
akwizgran b480777548 Services should throw exceptions for startup errors. 2016-04-05 15:44:50 +01:00
akwizgran 205dc66572 Test cleanup. #280 2016-04-05 14:19:10 +01:00
akwizgran bbd14f1af4 Merge branch '279-create-client-state' into 'master'
Create local state for clients at startup. #279

Most of the clients we've written so far use private groups shared with individual contacts and/or a local group that's not shared with anyone. To make it easier to ensure that the necessary groups exist when we need them, this patch allows clients to register startup hooks for creating their local state.

Fixes #279.

See merge request !131
2016-04-04 15:07:37 +00:00
akwizgran 8850a2ad61 Merge branch 'non-reentrant-db-lock' into 'master'
Don't allow reentrant transactions

The database's transaction lock is reentrant, meaning that a thread that's already holding the lock can acquire it again. This would allow a thread that already has a transaction in progress to start another transaction, which could cause transaction isolation issues and/or lock timeouts on the database's internal locks.

Check that the current thread isn't already holding the lock when starting a transaction.

See merge request !127
2016-04-04 15:06:22 +00:00
akwizgran 945b5eb1ac Create local state for clients at startup. #279 2016-04-01 17:15:35 +01:00
akwizgran db6c813522 Merge branch '117-qr-contacts' into 'master'
BQP with QR codes

This MR implements BQP for key agreement over short-range transports. It also implements the Android UI for using BQP with QR codes.

Closes #117.

See merge request !84
2016-03-31 11:21:02 +00:00
akwizgran 7e3d3625aa Don't allow reentrant transactions.
The database's transaction lock is reentrant, meaning that a thread that's already holding the lock can acquire it again. This would allow a thread that already has a transaction in progress to start another transaction, which could cause transaction isolation issues and/or lock timeouts on the database's internal locks.

Check that the current thread isn't already holding the lock when starting a transaction.
2016-03-31 11:02:52 +01:00
akwizgran 89d25d35d2 Save queue state before delivering message. #272 2016-03-30 17:15:45 +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
str4d 5ff7adcebf Test BQP implementation 2016-03-26 15:53:02 +13: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
Ernir Erlingsson 11bfa212cc minor tweaks 2016-03-14 21:02:51 +01:00
Ernir Erlingsson 10764d727b rebased with master 2016-03-14 21:02:51 +01:00
Ernir Erlingsson 1be400eb84 Switched Roboguice/Guice out for Dagger 2 2016-03-14 21:01:21 +01: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
akwizgran 02eca8ec38 Unit tests for MessageQueueManagerImpl. 2016-03-11 17:18:10 +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 c9276de399 Renamed validation hooks to incoming message hooks. 2016-03-07 18:36:30 +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 db188657ca Reuse BdfReader/Writer for MetadataParser/Encoder. 2016-03-04 21:00:30 +00:00
akwizgran 154e95a989 Merge branch 'client-helper' into 'master'
Helper class to reduce client boilerplate

* Renamed BdfReader methods for consistency with BdfList/BdfDictionary
* Added readList() and readDictionary() methods to BdfReader
* Added ClientHelper to reduce boilerplate when converting messages and metadata to and from BDF
* Moved PrivateGroupFactory to the same package as ClientHelper


See merge request !114
2016-02-29 14:37:45 +00:00
akwizgran 75d53598b0 Merge branch 'validation-manager-tests' into 'master'
Unit tests for ValidationManagerImpl

Unit test for the validation manager. I also changed the way the validation manager loads unvalidated messages - instead of using a single DB task to load all unvalidated messages, it loads a list of message IDs and then loads each message in a separate task. This prevents the DatabaseExecutor from being blocked by a long-running task if there are lots of messages to validate.

See merge request !113
2016-02-29 14:35:30 +00:00
akwizgran 640f5484e0 Moved PrivateGroupFactory to clients package. 2016-02-29 14:25:29 +00:00
akwizgran 2e7df53dba Added helper class so clients can use less boilerplate. 2016-02-29 14:23:50 +00:00
akwizgran 9e0add7d4c Renamed BdfWriter methods, added support for NULL_VALUE. 2016-02-29 14:23:49 +00:00
akwizgran 3ce62818aa Renamed BdfReader methods, added convenience methods. 2016-02-29 14:23:49 +00:00
Torsten Grote 9dec498e7e Merge branch 'add-contact-transaction' into 'master'
Add contact and transport keys in the same transaction

This avoids a potential problem where the app crashes after adding the contact but before adding the transport keys, leaving the contact unusable.

See merge request !112
2016-02-29 14:07:33 +00:00
akwizgran e3374b7584 Rename BDF methods. 2016-02-29 11:57:42 +00:00
akwizgran 5045b58e01 Explicitly check array lengths. 2016-02-29 11:51:16 +00:00
akwizgran e28dc17881 Helper methods and unit tests for BdfList/Dictionary. 2016-02-26 16:27:24 +00:00
akwizgran 476b1edbad Unit tests for ValidationManagerImpl. 2016-02-26 14:16:25 +00:00
akwizgran b8cf508b0c Moved ImmediateExecutor out of plugins package. 2016-02-26 14:16:09 +00:00
akwizgran 1d89c6cebc Add contact and transport keys in the same transaction.
This avoids a potential problem where the app crashes after adding the contact but before adding the transport keys, leaving the contact unusable.
2016-02-26 10:57:32 +00:00
akwizgran fee4beae63 Merge branch '252-lan-polling' into 'master'
New polling logic for LAN. #252

Same approach as !104. Modified the poller to cancel any scheduled poll when pollNow() is called and randomise the next polling interval so plugins that call pollNow() at the same time don't end up polling in sync.

Depends on !104. Fixes #252.

See merge request !105
2016-02-24 20:11:54 +00:00
akwizgran d829d4711b Merge branch '251-bluetooth-polling' into 'master'
New polling logic for Bluetooth. #251

Increase the polling interval exponentially each time polling is unsuccessful, up to a maximum of 60 minutes. The interval is reset to 2 minutes whenever a connection is made and whenever Bluetooth is re-enabled.

This should reduce battery usage when there are no contacts nearby.

Fixes #251.

See merge request !104
2016-02-24 20:08:05 +00:00
akwizgran 5ce8927477 New polling logic for LAN (and WAN). #252
Same exponential backoff approach as Bluetooth.
2016-02-22 13:25:07 +00:00