You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by so...@apache.org on 2016/11/07 17:40:30 UTC

[trafficserver] branch 6.2.x updated: TS-4885: Correct the calculation of fds_throttle and fds_limit

This is an automated email from the ASF dual-hosted git repository.

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

The following commit(s) were added to refs/heads/6.2.x by this push:
       new  e9d2e99   TS-4885: Correct the calculation of fds_throttle and fds_limit
e9d2e99 is described below

commit e9d2e99bca00009a2d91f48aab546c734c5e1be7
Author: Oknet Xu <xu...@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 5f8afae..4d98c48 100644
--- a/proxy/Main.cc
+++ b/proxy/Main.cc
@@ -900,7 +900,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)
       MachineFatal("too few file descritors (%d) available", fds_limit);
@@ -1028,7 +1028,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" <co...@trafficserver.apache.org>'].