summaryrefslogtreecommitdiff
path: root/app/src
diff options
context:
space:
mode:
authorParménides GV <parmegv@sdf.org>2015-03-24 13:07:58 +0100
committerParménides GV <parmegv@sdf.org>2015-03-24 13:07:58 +0100
commit81f7654a8120b065afd3767ad64e5ad7b57dfbf5 (patch)
tree9950d3172065b005dfe2f54baafe5b0ff6a048f9 /app/src
parent30d92be6e9401926d9efaafc332d764211d882e6 (diff)
parent7dba6442fb80cb55fe66f3d9510f71b80cb9e2b0 (diff)
Merge branch 'feature/Detect-more-errors-in-the-VPN-bootstrap-#6802' into develop
Diffstat (limited to 'app/src')
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/EipFragment.java4
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java16
-rw-r--r--app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java2
3 files changed, 15 insertions, 7 deletions
diff --git a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
index 5e5b76b2..8b532e24 100644
--- a/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
+++ b/app/src/main/java/se/leap/bitmaskclient/EipFragment.java
@@ -53,7 +53,6 @@ public class EipFragment extends Fragment implements Observer {
private boolean is_starting_to_connect;
private boolean wants_to_connect;
- @Override
public void onAttach(Activity activity) {
super.onAttach(activity);
@@ -293,8 +292,7 @@ public class EipFragment extends Fragment implements Observer {
private void setDisconnectedUI(){
hideProgressBar();
adjustSwitch();
- String last_log_message = eip_status.getLastLogMessage(dashboard.getApplicationContext());
- if((last_log_message.contains("error") || last_log_message.contains("ERROR"))
+ if(eip_status.errorInLast(5, dashboard.getApplicationContext())
&& !status_message.getText().toString().equalsIgnoreCase(dashboard.getString(R.string.eip_state_not_connected))){
dashboard.showLog();
}
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java b/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java
index 14158696..17e290b8 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/EipStatus.java
@@ -136,9 +136,19 @@ public class EipStatus extends Observable implements VpnStatus.StateListener {
EipStatus.level = level;
}
- public String getLastLogMessage(Context context) {
- VpnStatus.LogItem[] log = VpnStatus.getlogbuffer();
- return log[log.length-1].getString(context);
+ public boolean errorInLast(int lines, Context context) {
+ boolean result = false;
+ String[] error_keywords = {"error", "ERROR", "fatal", "FATAL"};
+
+ VpnStatus.LogItem[] log = VpnStatus.getlogbuffer();
+ String message = "";
+ for (int i = 1; i <= lines && log.length > i; i++) {
+ message = log[log.length-i].getString(context);
+ for(int j = 0; j < error_keywords.length; j++)
+ if(message.contains(error_keywords[j]))
+ result = true;
+ }
+ return result;
}
@Override
diff --git a/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java b/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java
index 5f5dcabd..5af8b8f1 100644
--- a/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java
+++ b/app/src/main/java/se/leap/bitmaskclient/eip/VpnConfigGenerator.java
@@ -148,6 +148,6 @@ public class VpnConfigGenerator {
+ new_line
+ "persist-tun"
+ new_line
- + "auth-retry nointeract";
+ + "auth-retry nointeract"
}
}