summaryrefslogtreecommitdiff
path: root/android
diff options
context:
space:
mode:
authorArtur Dryomov <artur.dryomov@gmail.com>2013-08-01 19:44:47 +0300
committerArtur Dryomov <artur.dryomov@gmail.com>2013-08-01 19:47:07 +0300
commit7e07a45500dcbb891a85f0bc9b7049cf4d50bba1 (patch)
tree9cb85a4309f5411bb1976986508f3f14f6c653b1 /android
parent9864a2d5d4dbc9988ada970dfe713559e7db9326 (diff)
Change search timeouts from milliseconds to seconds.
Makes things readable and should prevent potential typing bugs. Change-Id: Ifcb90568859e94896f5c2a313546fe1fdd6fa4bc
Diffstat (limited to 'android')
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServersFinder.java5
-rw-r--r--android/sdremote/src/org/libreoffice/impressremote/communication/TcpServersFinder.java4
2 files changed, 5 insertions, 4 deletions
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServersFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServersFinder.java
index 4f1029b0c526..2152cef631d8 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServersFinder.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/BluetoothServersFinder.java
@@ -12,6 +12,7 @@ import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.TimeUnit;
import android.bluetooth.BluetoothAdapter;
import android.bluetooth.BluetoothDevice;
@@ -26,7 +27,7 @@ import org.libreoffice.impressremote.util.BluetoothOperator;
import org.libreoffice.impressremote.util.Intents;
class BluetoothServersFinder extends BroadcastReceiver implements ServersFinder, Runnable {
- private static final int SEARCH_DELAY_IN_MILLISECONDS = 1000 * 10;
+ private static final int SEARCH_DELAY_IN_SECONDS = 10;
private final Context mContext;
@@ -102,7 +103,7 @@ class BluetoothServersFinder extends BroadcastReceiver implements ServersFinder,
}
Handler aHandler = new Handler();
- aHandler.postDelayed(this, SEARCH_DELAY_IN_MILLISECONDS);
+ aHandler.postDelayed(this, TimeUnit.SECONDS.toMillis(SEARCH_DELAY_IN_SECONDS));
}
@Override
diff --git a/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServersFinder.java b/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServersFinder.java
index 9f50fc179949..f3280eb78dc5 100644
--- a/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServersFinder.java
+++ b/android/sdremote/src/org/libreoffice/impressremote/communication/TcpServersFinder.java
@@ -33,7 +33,7 @@ import org.libreoffice.impressremote.util.Intents;
class TcpServersFinder implements ServersFinder, Runnable {
private static final int SEARCH_DELAY_IN_SECONDS = 10;
- private static final int BLOCKING_TIMEOUT_IN_MILLISECONDS = 1000 * 10;
+ private static final int BLOCKING_TIMEOUT_IN_SECONDS = 10;
private static final int SEARCH_RESULT_BUFFER_SIZE = 1024;
@@ -74,7 +74,7 @@ class TcpServersFinder implements ServersFinder, Runnable {
private void setUpSearchSocket() {
try {
mSearchSocket = new DatagramSocket();
- mSearchSocket.setSoTimeout(BLOCKING_TIMEOUT_IN_MILLISECONDS);
+ mSearchSocket.setSoTimeout((int) TimeUnit.SECONDS.toMillis(BLOCKING_TIMEOUT_IN_SECONDS));
} catch (SocketException e) {
throw new RuntimeException("Unable to open search socket.");
}