Fixes for some multi-device bugs.
This commit is contained in:
parent
a0889130e5
commit
6e0ae70f02
2
pom.xml
2
pom.xml
|
@ -56,7 +56,7 @@
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.google.protobuf</groupId>
|
<groupId>com.google.protobuf</groupId>
|
||||||
<artifactId>protobuf-java</artifactId>
|
<artifactId>protobuf-java</artifactId>
|
||||||
<version>2.5.0</version>
|
<version>2.4.1</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
|
|
|
@ -88,12 +88,13 @@ public class MessageController {
|
||||||
rateLimiters.getMessagesLimiter().validate(source.getNumber());
|
rateLimiters.getMessagesLimiter().validate(source.getNumber());
|
||||||
|
|
||||||
try {
|
try {
|
||||||
if (messages.getRelay() != null) sendLocalMessage(source, destinationName, messages);
|
if (messages.getRelay() == null) sendLocalMessage(source, destinationName, messages);
|
||||||
else sendRelayMessage(source, destinationName, messages);
|
else sendRelayMessage(source, destinationName, messages);
|
||||||
} catch (NoSuchUserException e) {
|
} catch (NoSuchUserException e) {
|
||||||
throw new WebApplicationException(Response.status(404).build());
|
throw new WebApplicationException(Response.status(404).build());
|
||||||
} catch (MismatchedDevicesException e) {
|
} catch (MismatchedDevicesException e) {
|
||||||
throw new WebApplicationException(Response.status(409)
|
throw new WebApplicationException(Response.status(409)
|
||||||
|
.type(MediaType.APPLICATION_JSON_TYPE)
|
||||||
.entity(new MismatchedDevices(e.getMissingDevices(),
|
.entity(new MismatchedDevices(e.getMissingDevices(),
|
||||||
e.getExtraDevices()))
|
e.getExtraDevices()))
|
||||||
.build());
|
.build());
|
||||||
|
|
|
@ -63,7 +63,8 @@ public abstract class Keys {
|
||||||
@Mapper(PreKeyMapper.class)
|
@Mapper(PreKeyMapper.class)
|
||||||
abstract PreKey retrieveFirst(@Bind("number") String number, @Bind("device_id") long deviceId);
|
abstract PreKey retrieveFirst(@Bind("number") String number, @Bind("device_id") long deviceId);
|
||||||
|
|
||||||
@SqlQuery("SELECT DISTINCT ON (number, device_id) * FROM keys WHERE number = :number ORDER BY key_id ASC FOR UPDATE")
|
@SqlQuery("SELECT DISTINCT ON (number, device_id) * FROM keys WHERE number = :number ORDER BY number, device_id, key_id ASC")
|
||||||
|
@Mapper(PreKeyMapper.class)
|
||||||
abstract List<PreKey> retrieveFirst(@Bind("number") String number);
|
abstract List<PreKey> retrieveFirst(@Bind("number") String number);
|
||||||
|
|
||||||
@Transaction(TransactionIsolationLevel.SERIALIZABLE)
|
@Transaction(TransactionIsolationLevel.SERIALIZABLE)
|
||||||
|
|
Loading…
Reference in New Issue