summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorAfzal Najam <AfzalivE@users.noreply.github.com>2020-05-04 23:19:37 -0400
committerArne Schwabe <arne@rfc2549.org>2020-05-05 07:26:10 +0200
commit3556185e9f632ddb54a569379d7de761e4fb8d6c (patch)
tree55f8667825d615c5254772024b847034f0015da7 /main
parentf1261b67d1af55f32cab123052d089da21515c3f (diff)
Fixes #1188 Optimize pattern compile for logging
Diffstat (limited to 'main')
-rw-r--r--main/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java8
1 files changed, 3 insertions, 5 deletions
diff --git a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java
index 4119f52c..56eff75f 100644
--- a/main/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java
+++ b/main/src/main/java/de/blinkt/openvpn/core/OpenVPNThread.java
@@ -30,6 +30,8 @@ public class OpenVPNThread implements Runnable {
private static final String BROKEN_PIE_SUPPORT = "/data/data/de.blinkt.openvpn/cache/pievpn";
private final static String BROKEN_PIE_SUPPORT2 = "syntax error";
private static final String TAG = "OpenVPN";
+ // 1380308330.240114 18000002 Send to HTTP proxy: 'X-Online-Host: bla.blabla.com'
+ private static final Pattern LOG_PATTERN = Pattern.compile("(\\d+).(\\d+) ([0-9a-f])+ (.*)");
public static final int M_FATAL = (1 << 4);
public static final int M_NONFATAL = (1 << 5);
public static final int M_WARN = (1 << 6);
@@ -148,11 +150,7 @@ public class OpenVPNThread implements Runnable {
if (logline.startsWith(BROKEN_PIE_SUPPORT) || logline.contains(BROKEN_PIE_SUPPORT2))
mBrokenPie = true;
-
- // 1380308330.240114 18000002 Send to HTTP proxy: 'X-Online-Host: bla.blabla.com'
-
- Pattern p = Pattern.compile("(\\d+).(\\d+) ([0-9a-f])+ (.*)");
- Matcher m = p.matcher(logline);
+ Matcher m = LOG_PATTERN.matcher(logline);
int logerror = 0;
if (m.matches()) {
int flags = Integer.parseInt(m.group(3), 16);