Commit Graph

2107 Commits

Author SHA1 Message Date
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
Torsten Grote
5ea7ff2857 UI for introducing two contacts to each other
Show system notification for successful introductions
2016-04-12 17:04:52 -03:00
Torsten Grote
7c687736df Merge branch '287-local-identities-as-contacts' into 'master'
Don't allow local identities to be added as contacts

Fixes #287

See merge request !137
2016-04-12 20:04:16 +00: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
a15dc951c5 Merge branch 'connect-to-new-contacts' into 'master'
Connect to new contacts

The motivation for this change was realising that when we add a new contact, if the Tor plugin has finished publishing its descriptor and stopped polling, we'll never try to connect to that contact via Tor. I decided that instead of making a special case for Tor, we should try to connect to new contacts via all transports.

Changes:
* Don't register outgoing connections until we've read the incoming tag - this prevents the connection indicator from blinking when connecting to a contact who's removed us
* Connect to newly activated contacts using all available transports, without waiting for the poller
* Removed device IDs from transport properties, we don't know how we're going to handle multi-device support yet


See merge request !135
2016-04-06 16:13:59 +00:00
akwizgran
3c2378e024 Fixed indentation. 2016-04-06 17:12:27 +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
akwizgran
88852de283 Renamed AndroidModule to AppModule. 2016-04-06 17:02:56 +01: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
bd38a84322 Merge branch '281-close-transport-connection' into 'master'
Close transport connection if tag isn't recognised. #281

Factored out common code from various DuplexTransportConnection implementations into an abstract superclass, and changed the logic for closing connections so that connections with unrecognised tags are closed immediately. This prevents deleted contacts from thinking they're connected to us when they're not.

See merge request !132
2016-04-06 14:58:05 +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
dc1adc21ae Merged AppModule and AndroidModule. 2016-04-05 14:16:42 +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
355c84d7ac Merge branch '123-crash-xml-layout' into 'master'
Migrate CrashReportActivity to XML layout

Part of #123.

See merge request !126
2016-04-04 15:07:05 +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
str4d
884d8530b4 Migrate CrashReportActivity to XML layout 2016-04-02 16:54:05 +13:00
akwizgran
945b5eb1ac Create local state for clients at startup. #279 2016-04-01 17:15:35 +01:00
akwizgran
845d3fa47e Bumped expiry date to 1 May 2016. 2016-04-01 12:21:58 +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
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
e78ba2e806 Key derivation fixes, renamed a key derivation method. 2016-03-30 12:02:49 +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
a8fa6339fb Don't disable Bluetooth, always reuse the connection. 2016-03-30 10:38:38 +01:00
akwizgran
ed6c3fb1e3 Expect runtime exceptions from camera API methods. 2016-03-29 17:22:59 +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
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