--- 2.25b-pristine/thttpd.c 2005-06-29 19:50:59.000000000 +0200 +++ head/thttpd.c 2005-12-26 22:03:31.000000000 +0100 @@ -1409,7 +1409,8 @@ if ( sscanf( buf, " %4900[^ \t] %ld-%ld", pattern, &min_limit, &max_limit ) == 3 ) {} else if ( sscanf( buf, " %4900[^ \t] %ld", pattern, &max_limit ) == 2 ) - min_limit = 0; + // pink: we are now using min_limit to set max connections, so it should be something large to begin with: + min_limit = 1000000; // pink: set to something large, should be a max value else { syslog( LOG_CRIT, @@ -1892,11 +1893,13 @@ if ( match( throttles[tnum].pattern, c->hc->expnfilename ) ) { /* If we're way over the limit, don't even start. */ - if ( throttles[tnum].rate > throttles[tnum].max_limit * 2 ) - return 0; - /* Also don't start if we're under the minimum. */ - if ( throttles[tnum].rate < throttles[tnum].min_limit ) - return 0; + //if ( throttles[tnum].rate > throttles[tnum].max_limit * 2 ) + // return 0; + // pink: max connections: if we are on the way to too many connections, don't start new connections: + if ( throttles[tnum].num_sending >= throttles[tnum].min_limit){ + syslog( LOG_NOTICE, "pink: dropping connection, allowed: %d, currently: %d", throttles[tnum].min_limit, throttles[tnum].num_sending); + return 0; + } if ( throttles[tnum].num_sending < 0 ) { syslog( LOG_ERR, "throttle sending count was negative - shouldn't happen!" ); @@ -1952,10 +1955,7 @@ else syslog( LOG_INFO, "throttle #%d '%.80s' rate %ld exceeding limit %ld; %d sending", tnum, throttles[tnum].pattern, throttles[tnum].rate, throttles[tnum].max_limit, throttles[tnum].num_sending ); } - if ( throttles[tnum].rate < throttles[tnum].min_limit && throttles[tnum].num_sending != 0 ) - { - syslog( LOG_NOTICE, "throttle #%d '%.80s' rate %ld lower than minimum %ld; %d sending", tnum, throttles[tnum].pattern, throttles[tnum].rate, throttles[tnum].min_limit, throttles[tnum].num_sending ); - } + // pink: removed logging on hit on "rate lower than minimum" } /* Now update the sending rate on all the currently-sending connections,