diff options
author | lado <herrlado@gmail.com> | 2011-11-07 23:10:02 +0100 |
---|---|---|
committer | lado <herrlado@gmail.com> | 2011-11-07 23:10:02 +0100 |
commit | d593e26023996fec1f27b7dfd6073c5787cf90b2 (patch) | |
tree | e81de146d5646986d608e5cec113b818d237ad3e /vdrmanager/src/de | |
parent | 831e8419d7d2e0cc88187c26c2f7f53c72c6911f (diff) | |
download | vdr-manager-d593e26023996fec1f27b7dfd6073c5787cf90b2.tar.gz vdr-manager-d593e26023996fec1f27b7dfd6073c5787cf90b2.tar.bz2 |
connection timeout svdrp event
Diffstat (limited to 'vdrmanager/src/de')
5 files changed, 23 insertions, 2 deletions
diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java index 412b4de..c6fccc6 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/BaseActivity.java @@ -50,6 +50,7 @@ public abstract class BaseActivity<Result, T extends ListView> extends Activity protected void switchNoConnection() { if (flipper == null) { + say(R.string.no_connection); return; } @@ -152,6 +153,9 @@ public abstract class BaseActivity<Result, T extends ListView> extends Activity protected boolean noConnection(SvdrpEvent event) { switch (event) { + case CONNECTION_TIMEOUT: + say(R.string.progress_connect_timeout); + switchNoConnection(); case CONNECT_ERROR: say(R.string.progress_connect_error); switchNoConnection(); @@ -220,6 +224,7 @@ public abstract class BaseActivity<Result, T extends ListView> extends Activity case CONNECTED: connected(); break; + case CONNECTION_TIMEOUT: case CONNECT_ERROR: case FINISHED_ABNORMALY: case LOGIN_ERROR: diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/gui/SvdrpProgressDialog.java b/vdrmanager/src/de/bjusystems/vdrmanager/gui/SvdrpProgressDialog.java index 304e922..1b3b1a9 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/gui/SvdrpProgressDialog.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/gui/SvdrpProgressDialog.java @@ -31,6 +31,7 @@ public class SvdrpProgressDialog<T> extends ProgressDialog implements public void svdrpEvent(final SvdrpEvent sevent, T e) { switch (sevent) { case ABORTED: + case CONNECTION_TIMEOUT: case CONNECT_ERROR: case ERROR: case LOGIN_ERROR: diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/tasks/AsyncProgressTask.java b/vdrmanager/src/de/bjusystems/vdrmanager/tasks/AsyncProgressTask.java index 09c796f..26bc510 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/tasks/AsyncProgressTask.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/tasks/AsyncProgressTask.java @@ -20,6 +20,7 @@ public abstract class AsyncProgressTask<Result> { switch (event) { case ABORTED: case CONNECT_ERROR: + case CONNECTION_TIMEOUT: case ERROR: case LOGIN_ERROR: case FINISHED_ABNORMALY: diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java index 58b64f2..f8ff229 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpClient.java @@ -6,6 +6,7 @@ import java.io.InputStream; import java.io.OutputStream; import java.net.InetSocketAddress; import java.net.Socket; +import java.net.SocketTimeoutException; import java.util.ArrayList; import java.util.List; import java.util.Timer; @@ -154,7 +155,7 @@ public abstract class SvdrpClient<Result> { new InetSocketAddress(prefs.getSvdrpHost(), prefs .getSvdrpPort()), prefs.getConnectionTimeout() * 1000);// 8 secs for connect - if(abort){ + if (abort) { informListener(SvdrpEvent.ABORTED, null); } // @@ -175,9 +176,18 @@ public abstract class SvdrpClient<Result> { } }, delay); informListener(SvdrpEvent.CONNECTED, null); + } catch (final SocketTimeoutException sote) { + Log.w(TAG, sote); + if (abort) { + informListener(SvdrpEvent.ABORTED, null); + } else { + informListener(SvdrpEvent.CONNECTION_TIMEOUT, null); + } + return false; } catch (final Exception e) { + Log.w(TAG, e); - if(abort){ + if (abort) { informListener(SvdrpEvent.ABORTED, null); } else { informListener(SvdrpEvent.CONNECT_ERROR, null); diff --git a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpEvent.java b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpEvent.java index 4384136..7eb6fac 100644 --- a/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpEvent.java +++ b/vdrmanager/src/de/bjusystems/vdrmanager/utils/svdrp/SvdrpEvent.java @@ -17,4 +17,8 @@ public enum SvdrpEvent { ABORTED, ERROR, CACHE_HIT, + CONNECTION_TIMEOUT + // + ; + } |