Skip to content

Commit

Permalink
Refine header parser
Browse files Browse the repository at this point in the history
  • Loading branch information
madeye committed Sep 9, 2016
1 parent d367853 commit b76f410
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 11 deletions.
4 changes: 4 additions & 0 deletions src/main/assets/acl/gfwlist.acl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@
[bypass_all]

[white_list]
# Telegram IPs
91.108.4.0/22
91.108.56.0/22
149.154.160.0/20
.*4tern\.com
.*adorama\.com
.*akiba-web\.com
Expand Down
4 changes: 2 additions & 2 deletions src/main/jni/Android.mk
Original file line number Diff line number Diff line change
Expand Up @@ -390,6 +390,7 @@ LOCAL_SRC_FILES := $(addprefix shadowsocks-libev/src/, $(SHADOWSOCKS_SOURCES))
LOCAL_CFLAGS := -Wall -O2 -fno-strict-aliasing -DMODULE_LOCAL \
-DUSE_CRYPTO_MBEDTLS -DANDROID -DHAVE_CONFIG_H \
-DCONNECT_IN_PROGRESS=EINPROGRESS \
-I$(LOCAL_PATH)/include/shadowsocks-libev \
-I$(LOCAL_PATH)/include \
-I$(LOCAL_PATH)/libancillary \
-I$(LOCAL_PATH)/mbedtls/include \
Expand All @@ -399,8 +400,7 @@ LOCAL_CFLAGS := -Wall -O2 -fno-strict-aliasing -DMODULE_LOCAL \
-I$(LOCAL_PATH)/shadowsocks-libev/libsodium/src/libsodium/include \
-I$(LOCAL_PATH)/shadowsocks-libev/libsodium/src/libsodium/include/sodium \
-I$(LOCAL_PATH)/shadowsocks-libev/libipset/include \
-I$(LOCAL_PATH)/shadowsocks-libev/libev \
-I$(LOCAL_PATH)/include/shadowsocks-libev
-I$(LOCAL_PATH)/shadowsocks-libev/libev

LOCAL_STATIC_LIBRARIES := libev libmbedtls libipset libcork libudns \
libsodium libancillary libpcre
Expand Down
6 changes: 6 additions & 0 deletions src/main/jni/include/shadowsocks-libev/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -417,3 +417,9 @@

/* Define as `fork' if `vfork' does not work. */
/* #undef vfork */

/* Define to 1 if you have the <pcre.h> header file. */
#define HAVE_PCRE_H 1

/* Define to 1 if you have the <pcre/pcre.h> header file. */
/* #undef HAVE_PCRE_PCRE_H */
21 changes: 13 additions & 8 deletions src/main/scala/com/github/shadowsocks/GuardedProcess.scala
Original file line number Diff line number Diff line change
Expand Up @@ -97,14 +97,17 @@ class GuardedProcess(cmd: Seq[String]) {
semaphore.release
process.waitFor

if (isRestart) {
isRestart = false
} else {
if (currentTimeMillis - startTime < 1000) {
Log.w(TAG, "process exit too fast, stop guard: " + cmd)
isDestroyed = true
this.synchronized {
if (isRestart) {
isRestart = false
} else {
if (currentTimeMillis - startTime < 1000) {
Log.w(TAG, "process exit too fast, stop guard: " + cmd)
isDestroyed = true
}
}
}

}
} catch {
case ignored: InterruptedException =>
Expand Down Expand Up @@ -134,8 +137,10 @@ class GuardedProcess(cmd: Seq[String]) {
}

def restart() {
isRestart = true
process.destroy()
this.synchronized {
isRestart = true
process.destroy()
}
}

@throws(classOf[InterruptedException])
Expand Down

0 comments on commit b76f410

Please sign in to comment.