You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@trafficserver.apache.org by James Peach <jp...@apache.org> on 2016/04/14 23:37:42 UTC

Re: [trafficserver] branch master updated: TS-4340: fix small issue related to match typ e NONE

> On Apr 14, 2016, at 1:44 PM, briang@apache.org wrote:
> 
> This is an automated email from the ASF dual-hosted git repository.
> 
> briang pushed a commit to branch master
> in repository https://git-dual.apache.org/repos/asf/trafficserver.git
> 
> The following commit(s) were added to refs/heads/master by this push:
>       new  8d4c256   TS-4340: fix small issue related to match typ e NONE
> 8d4c256 is described below
> 
> commit 8d4c25653bb038f70651b8675a5969e522668d43
> Author: Brian Geffon <br...@apache.org>
> AuthorDate: Thu Mar 3 15:45:41 2016 -0800
> 
>    TS-4340: fix small issue related to match typ e NONE
> ---
> proxy/http/HttpConnectionCount.h | 8 ++++++++
> proxy/http/HttpServerSession.cc  | 4 ++--
> 2 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/proxy/http/HttpConnectionCount.h b/proxy/http/HttpConnectionCount.h
> index b025e8f..eea0d1a 100644
> --- a/proxy/http/HttpConnectionCount.h
> +++ b/proxy/http/HttpConnectionCount.h
> @@ -58,6 +58,10 @@ public:
>   int
>   getCount(const IpEndpoint &addr, const INK_MD5 &hostname_hash, TSServerSessionSharingMatchType match_type)
>   {
> +    if (TS_SERVER_SESSION_SHARING_MATCH_NONE == match_type) {
> +      return 0; // We can never match a node if match type is NONE
> +    }
> +
>     ink_mutex_acquire(&_mutex);
>     int count = _hostCount.get(ConnAddr(addr, hostname_hash, match_type));
>     ink_mutex_release(&_mutex);
> @@ -73,6 +77,10 @@ public:
>   incrementCount(const IpEndpoint &addr, const INK_MD5 &hostname_hash, TSServerSessionSharingMatchType match_type,
>                  const int delta = 1)
>   {
> +    if (TS_SERVER_SESSION_SHARING_MATCH_NONE == match_type) {
> +      return; // We can never match a node if match type is NONE.
> +    }
> +
>     ConnAddr caddr(addr, hostname_hash, match_type);
>     ink_mutex_acquire(&_mutex);
>     int count = _hostCount.get(caddr);
> diff --git a/proxy/http/HttpServerSession.cc b/proxy/http/HttpServerSession.cc
> index 763c6b8..d2f2386 100644
> --- a/proxy/http/HttpServerSession.cc
> +++ b/proxy/http/HttpServerSession.cc
> @@ -140,14 +140,14 @@ HttpServerSession::do_io_close(int alerrno)
>   // Check to see if we are limiting the number of connections
>   // per host
>   if (enable_origin_connection_limiting == true) {
> -    if (connection_count->getCount(server_ip, hostname_hash, sharing_match) > 0) {
> +    if (connection_count->getCount(server_ip, hostname_hash, sharing_match) >= 0) {

Surely a count of -1 is a bug? It should be a release_assert?

>       connection_count->incrementCount(server_ip, hostname_hash, sharing_match, -1);
>       ip_port_text_buffer addrbuf;
>       Debug("http_ss", "[%" PRId64 "] connection closed, ip: %s, count: %u", con_id,
>             ats_ip_nptop(&server_ip.sa, addrbuf, sizeof(addrbuf)),
>             connection_count->getCount(server_ip, hostname_hash, sharing_match));
>     } else {
> -      Error("[%" PRId64 "] number of connections should be greater than zero: %u", con_id,
> +      Error("[%" PRId64 "] number of connections should be greater than or equal to zero: %u", con_id,
>             connection_count->getCount(server_ip, hostname_hash, sharing_match));
>     }
>   }
> 
> -- 
> To stop receiving notification emails like this one, please contact
> ['"commits@trafficserver.apache.org" <co...@trafficserver.apache.org>'].