mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 21:15:48 +00:00
Configure keep alive duration for okhttp connection pool to 1 minute.
The signal http server supports http keep alive, but closes idle connections after 1 minute. The default OkHttp connection pool will keep idle connections in the pool for 5 minutes and doesn't notice it when the server closes connections. As currently the automatic okhttp retries are disabled, reusing such a stale connection will be fatal. Issue is especially severe for incoming calls, which fail because the request to retrieve the turn servers fails and isn't retried: #10787
This commit is contained in:
@@ -138,6 +138,7 @@ import javax.net.ssl.X509TrustManager;
|
||||
|
||||
import okhttp3.Call;
|
||||
import okhttp3.Callback;
|
||||
import okhttp3.ConnectionPool;
|
||||
import okhttp3.ConnectionSpec;
|
||||
import okhttp3.Credentials;
|
||||
import okhttp3.Dns;
|
||||
@@ -1807,6 +1808,8 @@ public class PushServiceSocket {
|
||||
.connectionSpecs(url.getConnectionSpecs().or(Util.immutableList(ConnectionSpec.RESTRICTED_TLS)))
|
||||
.build();
|
||||
|
||||
builder.connectionPool(new ConnectionPool(5, 45, TimeUnit.SECONDS));
|
||||
|
||||
for (Interceptor interceptor : interceptors) {
|
||||
builder.addInterceptor(interceptor);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user