mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-02-19 09:17:58 +00:00
Compare commits
7 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e3ca18588 | ||
|
|
25a38b9eea | ||
|
|
e02aea9cfb | ||
|
|
a59ca8da13 | ||
|
|
72284ce5ec | ||
|
|
c795a0119c | ||
|
|
9cada7e229 |
20
README.md
20
README.md
@@ -96,4 +96,22 @@ try {
|
||||
if (messagePipe != null)
|
||||
messagePipe.close();
|
||||
}
|
||||
`````
|
||||
`````
|
||||
|
||||
# Legal things
|
||||
|
||||
## Cryptography Notice
|
||||
|
||||
This distribution includes cryptographic software. The country in which you currently reside may have restrictions on the import, possession, use, and/or re-export to another country, of encryption software.
|
||||
BEFORE using any encryption software, please check your country's laws, regulations and policies concerning the import, possession, or use, and re-export of encryption software, to see if this is permitted.
|
||||
See <http://www.wassenaar.org/> for more information.
|
||||
|
||||
The U.S. Government Department of Commerce, Bureau of Industry and Security (BIS), has classified this software as Export Commodity Control Number (ECCN) 5D002.C.1, which includes information security software using or performing cryptographic functions with asymmetric algorithms.
|
||||
The form and manner of this distribution makes it eligible for export under the License Exception ENC Technology Software Unrestricted (TSU) exception (see the BIS Export Administration Regulations, Section 740.13) for both object code and source code.
|
||||
|
||||
## License
|
||||
|
||||
Copyright 2013-2015 Open Whisper Systems
|
||||
|
||||
Licensed under the AGPLv3: https://www.gnu.org/licenses/agpl-3.0.html
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
subprojects {
|
||||
ext.version_number = "1.2.2"
|
||||
ext.version_number = "1.2.5"
|
||||
ext.group_info = "org.whispersystems"
|
||||
ext.axolotl_version = "1.3.1"
|
||||
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
package org.whispersystems.textsecure.internal.push;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
|
||||
public class ProvisioningMessage {
|
||||
|
||||
@JsonProperty
|
||||
private String body;
|
||||
|
||||
public ProvisioningMessage(String body) {
|
||||
|
||||
@@ -400,6 +400,7 @@ public class PushServiceSocket {
|
||||
|
||||
connection.setRequestMethod(method);
|
||||
connection.setRequestProperty("Content-Type", "application/octet-stream");
|
||||
connection.setRequestProperty("Connection", "close");
|
||||
connection.connect();
|
||||
|
||||
try {
|
||||
|
||||
@@ -48,13 +48,13 @@ public class OkHttpClientWrapper implements WebSocketListener {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public void connect() {
|
||||
public void connect(final int timeout, final TimeUnit timeUnit) {
|
||||
new Thread() {
|
||||
@Override
|
||||
public void run() {
|
||||
int attempt = 0;
|
||||
|
||||
while ((webSocket = newSocket()) != null) {
|
||||
while ((webSocket = newSocket(timeout, timeUnit)) != null) {
|
||||
try {
|
||||
Response response = webSocket.connect(OkHttpClientWrapper.this);
|
||||
|
||||
@@ -117,14 +117,17 @@ public class OkHttpClientWrapper implements WebSocketListener {
|
||||
listener.onClose();
|
||||
}
|
||||
|
||||
private synchronized WebSocket newSocket() {
|
||||
private synchronized WebSocket newSocket(int timeout, TimeUnit unit) {
|
||||
if (closed) return null;
|
||||
|
||||
String filledUri = String.format(uri, credentialsProvider.getUser(), credentialsProvider.getPassword());
|
||||
SSLSocketFactory socketFactory = createTlsSocketFactory(trustStore);
|
||||
String filledUri = String.format(uri, credentialsProvider.getUser(), credentialsProvider.getPassword());
|
||||
OkHttpClient okHttpClient = new OkHttpClient();
|
||||
|
||||
return WebSocket.newWebSocket(new OkHttpClient().setSslSocketFactory(socketFactory),
|
||||
new Request.Builder().url(filledUri).build());
|
||||
okHttpClient.setSslSocketFactory(createTlsSocketFactory(trustStore));
|
||||
okHttpClient.setReadTimeout(timeout, unit);
|
||||
okHttpClient.setConnectTimeout(timeout, unit);
|
||||
|
||||
return WebSocket.newWebSocket(okHttpClient, new Request.Builder().url(filledUri).build());
|
||||
}
|
||||
|
||||
private SSLSocketFactory createTlsSocketFactory(TrustStore trustStore) {
|
||||
|
||||
@@ -19,7 +19,8 @@ import static org.whispersystems.textsecure.internal.websocket.WebSocketProtos.W
|
||||
|
||||
public class WebSocketConnection implements WebSocketEventListener {
|
||||
|
||||
private static final String TAG = WebSocketConnection.class.getSimpleName();
|
||||
private static final String TAG = WebSocketConnection.class.getSimpleName();
|
||||
private static final int KEEPALIVE_TIMEOUT_SECONDS = 55;
|
||||
|
||||
private final LinkedList<WebSocketRequestMessage> incomingRequests = new LinkedList<>();
|
||||
|
||||
@@ -42,7 +43,7 @@ public class WebSocketConnection implements WebSocketEventListener {
|
||||
|
||||
if (client == null) {
|
||||
client = new OkHttpClientWrapper(wsUri, trustStore, credentialsProvider, this);
|
||||
client.connect();
|
||||
client.connect(KEEPALIVE_TIMEOUT_SECONDS + 10, TimeUnit.SECONDS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -140,6 +141,7 @@ public class WebSocketConnection implements WebSocketEventListener {
|
||||
|
||||
public synchronized void onConnected() {
|
||||
if (client != null && keepAliveSender == null) {
|
||||
Log.w(TAG, "onConnected()");
|
||||
keepAliveSender = new KeepAliveSender();
|
||||
keepAliveSender.start();
|
||||
}
|
||||
@@ -156,7 +158,7 @@ public class WebSocketConnection implements WebSocketEventListener {
|
||||
public void run() {
|
||||
while (!stop.get()) {
|
||||
try {
|
||||
Thread.sleep(TimeUnit.SECONDS.toMillis(55));
|
||||
Thread.sleep(TimeUnit.SECONDS.toMillis(KEEPALIVE_TIMEOUT_SECONDS));
|
||||
|
||||
Log.w(TAG, "Sending keep alive...");
|
||||
sendKeepAlive();
|
||||
|
||||
Reference in New Issue
Block a user