Setting write and read timeout to 5 seconds at the NetworkService

This commit is contained in:
Nelson R. Perez 2018-12-26 17:47:59 -05:00
parent 201d6957f8
commit 7a02e335a0

View file

@ -224,6 +224,8 @@ public class NetworkService extends Service {
OkHttpClient client = new OkHttpClient OkHttpClient client = new OkHttpClient
.Builder() .Builder()
.connectTimeout(2, TimeUnit.SECONDS) .connectTimeout(2, TimeUnit.SECONDS)
.readTimeout(5, TimeUnit.SECONDS)
.writeTimeout(5, TimeUnit.SECONDS)
.build(); .build();
mSelectedNode = nodeProvider.getBestNode(); mSelectedNode = nodeProvider.getBestNode();
Log.v(TAG,"connect.url: "+ mSelectedNode.getUrl()+", latency: "+mSelectedNode.getLatencyValue()); Log.v(TAG,"connect.url: "+ mSelectedNode.getUrl()+", latency: "+mSelectedNode.getLatencyValue());