summaryrefslogtreecommitdiff
path: root/app/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main')
-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"
}
}