Skip to content

Commit

Permalink
rc: httpd: don't drop caches on HND routers (backport from 49335)
Browse files Browse the repository at this point in the history
  • Loading branch information
RMerl committed Jun 10, 2022
1 parent 918e909 commit fe03424
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
4 changes: 4 additions & 0 deletions release/src/router/httpd/httpd.c
Expand Up @@ -983,7 +983,9 @@ int max_lock_time = MAX_LOGIN_BLOCK_TIME;
static void
handle_request(void)
{
#if !defined(RTCONFIG_HND_ROUTER)
static long flush_cache_t1 = 0;
#endif
char line[10000], *cur;
char *method, *path, *protocol, *authorization, *boundary, *alang, *cookies, *referer, *useragent;
char *cp;
Expand Down Expand Up @@ -1239,11 +1241,13 @@ handle_request(void)
snprintf(current_page_name, sizeof(current_page_name), "%s", url);
}

#if !defined(RTCONFIG_HND_ROUTER)
if (!strncmp(file, "Main_Login.asp", 14) && (uptime() - flush_cache_t1) > 10 * 60) {
/* free pagecahe when login, don't do it again in 10 minutes. */
f_write_string("/proc/sys/vm/drop_caches", "1", 0, 0);
flush_cache_t1 = uptime();
}
#endif
#if defined(RTCONFIG_QCA) && defined(RTCONFIG_QCA_LBD)
if (nvram_match("smart_connect_x", "1") && !nvram_match("wl_unit", "0")
&& strstr(url, "Advanced_Wireless_Content.asp")) {
Expand Down
2 changes: 2 additions & 0 deletions release/src/router/rc/services.c
Expand Up @@ -14959,7 +14959,9 @@ _dprintf("multipath(%s): unit_now: (%d, %d, %s), unit_next: (%d, %d, %s).\n", mo
nvram_set("apps_state_cancel", "");
nvram_set("apps_state_error", "");

#if !defined(RTCONFIG_HND_ROUTER)
free_caches(FREE_MEM_PAGE, 1, 0);
#endif

cmd[0] = nvtmp;
start_script(count, cmd);
Expand Down

0 comments on commit fe03424

Please sign in to comment.