Commit Graph

963 Commits

Author SHA1 Message Date
Torsten Grote
90d984ee52 Ensure responses shown after requests, clarify wording, reuse transactions
When devices' clocks are out of sync, it is possible that a response is
shown before the request. This commit makes sure that the timestamp of
responses is always later than the last message in the conversation.

Some wording could be misunderstood to thing introductions were
successful even though they were not. That has been clarified.

A new database transaction was created when getting contacts and local
transport properties. This has been changed to re-use the existing
transaction.

Also addresses minor issues found in review.
2016-04-12 17:04:52 -03:00
Torsten Grote
4b7a32a5ee Find correct session state in case the same one is used twice.
The code made the assumption that a session state can be identified by
the unique session ID. However, when multiple identities from the same
device are involved, there are two sessions with the same ID running on
the device.

Hence, a second identifying criteria has to be used to uniquely identify
the correct session. Here, the ID of the group was chosen.
Unfortunately, the session state can not be cached easily anymore
leading to a small performance penalty when getting all messages for the
UI.
2016-04-12 17:04:52 -03:00
akwizgran
40022b8326 Don't allow local identities to be added as contacts. 2016-04-11 13:24:25 +01:00
akwizgran
770015e5f9 Fixed wrong size check in introduction validator. 2016-04-06 18:06:42 +01:00
akwizgran
d38aa4fd9b Exchange transport properties when adding contact. 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
04a1f2b12c Don't poll plugins that don't support polling. 2016-04-06 17:10:54 +01:00
akwizgran
90f3d33f86 Log the transport ID when registering connections. 2016-04-06 17:10:54 +01:00
akwizgran
d5bf7194f6 Register outgoing duplex connection after reading tag.
This prevents the connection from being registered until the contact responds, which ensures we're actually connected to the contact.
2016-04-06 17:10:53 +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
Torsten Grote
21bb23ba67 Merge branch '273-service-exceptions' into 'master'
Services should throw exceptions for startup errors

Fixes #273

See merge request !134
2016-04-06 15:51:03 +00: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
2b19e4c8db Close transport connection if tag isn't recognised. #281 2016-04-05 11:37:38 +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
e44329a2b4 Removed debug logging from message queue manager. 2016-03-31 12:34:53 +01:00
akwizgran
4393517f31 Merge branch '118-contact-introductions' into 'master'
Contact Introduction Backend

This MR allows you to introduce two of your contacts to each other. They both will receive an introduction with an optional message and then can accept or refuse the introduction which is presented as a notification.

When reviewing, I propose to review the individual commits separately as I took great care to split functional independent parts into separate commits. You might also want to have a look at the [Introduction Client Wiki page](https://code.briarproject.org/akwizgran/briar/wikis/IntroductionClient) to better understand what is going on before looking into the actual code.

Protocol sessions and states are not yet deleted and the UI is still missing (#253). In order to practically test this feature, the UI from !122 is needed.

See merge request !116
2016-03-31 11:26:09 +00: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
5d1084ae84 Fixed a stupid forum post validation bug.
The signature covers the forum post body, not the message body.
2016-03-31 12:06:28 +01: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
Torsten Grote
54f320465f Add information about whether Contact is active to ContactAddedEvent 2016-03-30 13:36:14 -03:00
Torsten Grote
f44cb5ff94 Add an IntroductionManager and Validator
This Introduction BSP Client uses its own group to communicate with
existing contacts. It uses four types of messages to facilitate
introductions: the introduction, the response, the ack and the abort.

The protocol logic is encapsulated in two protocol engines, one for the
introducer and one for the introducee. The introduction client keeps the
local state for each engine, hands messages over to the engines and
processes the result and state changes they return.
2016-03-30 13:36:14 -03:00
Torsten Grote
e3459fb0a3 Use given transaction when adding remote properties in TransportPropertyManager. 2016-03-30 13:36:13 -03:00
Torsten Grote
5bde14c694 Add a contactExists() method to the contactManager
This requires exposing the `containsContact()` method to the `DatabaseComponent`
and is needed for finding out efficiently whether a contact already exists.
2016-03-30 13:36:13 -03:00
Torsten Grote
e2d64e0a8c allow adding contacts within an existing transactions 2016-03-30 13:36:13 -03:00
Torsten Grote
51c3528efa Add log statements to MessageQueueManagerImpl in order to find bug #272 2016-03-30 13:36:13 -03:00
akwizgran
89d25d35d2 Save queue state before delivering message. #272 2016-03-30 17:15:45 +01:00
akwizgran
e78ba2e806 Key derivation fixes, renamed a key derivation method. 2016-03-30 12:02:49 +01:00
akwizgran
a8fa6339fb Don't disable Bluetooth, always reuse the connection. 2016-03-30 10:38:38 +01: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
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
8cacc73bef Implement BQP Android UI using QR codes 2016-03-26 15:53:09 +13:00
str4d
701cfdba48 Extract contact exchange protocol from BT introduction protocol 2016-03-26 15:53:02 +13:00
str4d
c3997fb06f Implement BQP API 2016-03-26 15:53:02 +13:00
str4d
d2d8d9d46e Implement BQP transport descriptors 2016-03-26 15:52:58 +13:00
akwizgran
31f6c0bf50 More logging for MessageQueueManagerImpl. #272 2016-03-22 13:46:27 +00:00
akwizgran
3d57516258 Fixed merge issues. 2016-03-15 20:26:50 +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
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