trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bc...@apache.org
Subject [trafficserver] 01/04: TS-4885: Correct the calculation of fds_throttle and fds_limit
Date Sat, 15 Oct 2016 23:03:35 GMT
This is an automated email from the ASF dual-hosted git repository.

bcall pushed a commit to branch 7.0.x
in repository https://git-dual.apache.org/repos/asf/trafficserver.git

commit 0a1215c03b68c527fee4471fb93fee529e0a3999
Author: Oknet Xu <xuchao@skyguard.com.cn>
AuthorDate: Thu Sep 22 17:04:20 2016 +0800

    TS-4885: Correct the calculation of fds_throttle and fds_limit
    
    (cherry picked from commit 98bdac00dabc39d168eeddf19755abc5160d4c33)
---
 proxy/Main.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/proxy/Main.cc b/proxy/Main.cc
index 0b90900..125558d 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -904,7 +904,7 @@ check_fd_limit()
 {
   int fds_throttle = -1;
   REC_ReadConfigInteger(fds_throttle, "proxy.config.net.connections_throttle");
-  if (fds_throttle > fds_limit + THROTTLE_FD_HEADROOM) {
+  if (fds_throttle > fds_limit - THROTTLE_FD_HEADROOM) {
     int new_fds_throttle = fds_limit - THROTTLE_FD_HEADROOM;
     if (new_fds_throttle < 1) {
       ink_abort("too few file descriptors (%d) available", fds_limit);
@@ -1024,7 +1024,7 @@ adjust_sys_settings(void)
   REC_ReadConfigInteger(fds_throttle, "proxy.config.net.connections_throttle");
 
   if (getrlimit(RLIMIT_NOFILE, &lim) == 0) {
-    if (fds_throttle > (int)(lim.rlim_cur + THROTTLE_FD_HEADROOM)) {
+    if (fds_throttle > (int)(lim.rlim_cur - THROTTLE_FD_HEADROOM)) {
       lim.rlim_cur = (lim.rlim_max = (rlim_t)fds_throttle);
       if (setrlimit(RLIMIT_NOFILE, &lim) == 0 && getrlimit(RLIMIT_NOFILE, &lim)
== 0) {
         fds_limit = (int)lim.rlim_cur;

-- 
To stop receiving notification emails like this one, please contact
"commits@trafficserver.apache.org" <commits@trafficserver.apache.org>.

Mime
View raw message