diff --git a/UA2F/src/cache.c b/UA2F/src/cache.c index b65f7a7a8..15bdbfd07 100644 --- a/UA2F/src/cache.c +++ b/UA2F/src/cache.c @@ -31,14 +31,7 @@ _Noreturn static void check_cache() { } } -static _Atomic bool cache_initialized = false; - void init_not_http_cache() { - if (cache_initialized) { - return; - } - cache_initialized = true; - if (pthread_rwlock_init(&cacheLock, NULL) != 0) { syslog(LOG_ERR, "Failed to init cache lock"); exit(EXIT_FAILURE); diff --git a/UA2F/src/handler.c b/UA2F/src/handler.c index 937013e1a..dbdc94214 100644 --- a/UA2F/src/handler.c +++ b/UA2F/src/handler.c @@ -111,7 +111,8 @@ static void send_verdict( } } -static _Atomic bool conntrack_info_available = true; +static bool conntrack_info_available = true; +static bool cache_initialized = false; static void add_to_cache(struct nf_packet *pkt) { char *ip_str = ip_to_str(&pkt->orig.dst, pkt->orig.dst_port, pkt->orig.ip_version); @@ -173,7 +174,10 @@ void handle_packet(struct nf_queue *queue, struct nf_packet *pkt) { syslog(LOG_WARNING, "Packet has no conntrack. Switching to no cache mode."); syslog(LOG_WARNING, "Note that this may lead to performance degradation. Especially on low-end routers."); } else { - init_not_http_cache(); + if (!cache_initialized) { + init_not_http_cache(); + cache_initialized = true; + } } } diff --git a/hysteria/Makefile b/hysteria/Makefile index 47fcb15a3..f402f9774 100644 --- a/hysteria/Makefile +++ b/hysteria/Makefile @@ -5,12 +5,12 @@ include $(TOPDIR)/rules.mk PKG_NAME:=hysteria -PKG_VERSION:=2.1.1 +PKG_VERSION:=2.2.0 PKG_RELEASE:=1 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz PKG_SOURCE_URL:=https://codeload.github.com/apernet/hysteria/tar.gz/app/v$(PKG_VERSION)? -PKG_HASH:=a9ccbd7b38ccb9b8d0f3f75c18bd6846e32a58442dbdc2946629be4b3c5f6424 +PKG_HASH:=d3e6809ac2b8e1c58e1c95cdb96bd44d99b17c7824bdd931d4d51c9e3818d402 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-app-v$(PKG_VERSION) PKG_LICENSE:=MIT diff --git a/luci-app-wrtbwmon/htdocs/luci-static/resources/view/wrtbwmon/details.js b/luci-app-wrtbwmon/htdocs/luci-static/resources/view/wrtbwmon/details.js index 50b586ed1..e7e885947 100644 --- a/luci-app-wrtbwmon/htdocs/luci-static/resources/view/wrtbwmon/details.js +++ b/luci-app-wrtbwmon/htdocs/luci-static/resources/view/wrtbwmon/details.js @@ -136,8 +136,8 @@ function displayTable(tb, settings) { } function formatSize(size, useBits, useMultiple) { - var res = String.format('%%%s.2m%s'.format(useMultiple, (useBits ? 'bit' : 'B')), useBits ? size * 8 : size); - return useMultiple == '1024' ? res.replace(/([KMGTPEZ])/, '$&i') : res; + // String.format automatically adds the i for KiB if the multiple is 1024 + return String.format('%%%s.2m%s'.format(useMultiple, (useBits ? 'bit' : 'B')), useBits ? size * 8 : size); } function formatSpeed(speed, useBits, useMultiple) {