You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by ma...@apache.org on 2017/02/10 01:21:44 UTC

[trafficserver] branch master updated: npn string should be updated on unregistering a protocol as well

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

maskit 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  3dde26b   npn string should be updated on unregistering a protocol as well
3dde26b is described below

commit 3dde26b8a7c2f3f5f552840942005d0b43f65666
Author: Syeda Persia Aziz <pe...@yahoo.com>
AuthorDate: Wed Feb 8 23:10:11 2017 -0600

    npn string should be updated on unregistering a protocol as well
---
 iocore/net/SSLNextProtocolSet.cc | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/iocore/net/SSLNextProtocolSet.cc b/iocore/net/SSLNextProtocolSet.cc
index 6866349..83df312 100644
--- a/iocore/net/SSLNextProtocolSet.cc
+++ b/iocore/net/SSLNextProtocolSet.cc
@@ -48,7 +48,10 @@ create_npn_advertisement(const SSLNextProtocolSet::NextProtocolEndpoint::list_ty
   const SSLNextProtocolSet::NextProtocolEndpoint *ep;
   unsigned char *advertised;
 
-  *npn = nullptr;
+  if (*npn) {
+    ats_free(*npn);
+    *npn = nullptr;
+  }
   *len = 0;
 
   for (ep = endpoints.head; ep != nullptr; ep = endpoints.next(ep)) {
@@ -100,12 +103,6 @@ SSLNextProtocolSet::registerEndpoint(const char *proto, Continuation *ep)
   if (!findEndpoint((const unsigned char *)proto, len)) {
     this->endpoints.push(new NextProtocolEndpoint(proto, ep));
 
-    if (npn) {
-      ats_free(npn);
-      npn   = nullptr;
-      npnsz = 0;
-    }
-
     create_npn_advertisement(this->endpoints, &npn, &npnsz);
 
     return true;
@@ -122,6 +119,7 @@ SSLNextProtocolSet::unregisterEndpoint(const char *proto, Continuation *ep)
       // Protocol must be registered only once; no need to remove
       // any more entries.
       this->endpoints.remove(e);
+      create_npn_advertisement(this->endpoints, &npn, &npnsz);
       return true;
     }
   }

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