Compare commits

...

7 Commits

Author SHA1 Message Date
Moxie Marlinspike
0e3ca18588 Bump version to 1.2.5 2015-04-05 15:18:30 -07:00
Moxie Marlinspike
25a38b9eea Set websocket read timeout to keepalive interaval + 10s.
// FREEBIE
2015-04-05 15:18:08 -07:00
Moxie Marlinspike
e02aea9cfb Added legal things section to README
// FREEBIE
2015-03-27 09:47:31 -07:00
Moxie Marlinspike
a59ca8da13 Bump version to 1.2.4 2015-03-25 14:03:50 -07:00
Moxie Marlinspike
72284ce5ec Don't keepalive connections on external upload.
Workaround for an Android OS bug.

Fixes #1

// FREEBIE
2015-03-25 14:02:53 -07:00
Moxie Marlinspike
c795a0119c Bump version to 1.2.3 2015-03-19 12:29:43 -07:00
lilia
9cada7e229 Fix provisioning flow
Make ProvisionMessage serializable. Previously the lack of jackson
annotations caused this object to serialize as empty string, which
elicits a 500 from the server.

Closes #3
2015-03-10 19:38:34 -07:00
6 changed files with 39 additions and 12 deletions

View File

@@ -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

View File

@@ -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"

View File

@@ -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) {

View File

@@ -400,6 +400,7 @@ public class PushServiceSocket {
connection.setRequestMethod(method);
connection.setRequestProperty("Content-Type", "application/octet-stream");
connection.setRequestProperty("Connection", "close");
connection.connect();
try {

View File

@@ -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) {

View File

@@ -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();