trafficserver-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From zw...@apache.org
Subject [3/4] git commit: TS-2102 SPDY plugin tries to setup protocol handler too early.
Date Tue, 06 Aug 2013 19:59:24 GMT
TS-2102 SPDY plugin tries to setup protocol handler too early.


Project: http://git-wip-us.apache.org/repos/asf/trafficserver/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafficserver/commit/c1c963ef
Tree: http://git-wip-us.apache.org/repos/asf/trafficserver/tree/c1c963ef
Diff: http://git-wip-us.apache.org/repos/asf/trafficserver/diff/c1c963ef

Branch: refs/heads/3.3.x
Commit: c1c963efad8b7f7773c19c6720845d6c34daddcf
Parents: a7708df
Author: Leif Hedstrom <zwoop@apache.org>
Authored: Tue Aug 6 13:47:11 2013 -0600
Committer: Leif Hedstrom <zwoop@apache.org>
Committed: Tue Aug 6 13:47:11 2013 -0600

----------------------------------------------------------------------
 CHANGES                           |  2 ++
 plugins/experimental/spdy/spdy.cc | 24 ++++++++++++++++++------
 2 files changed, 20 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c963ef/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 9cdb0f6..c358bb5 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,8 @@
                                                          -*- coding: utf-8 -*-
 Changes with Apache Traffic Server 3.3.5
 
+  *) [TS-2102] SPDY plugin tries to setup protocol handler too early.
+
   *) [TS-1953] remove version checks from plugins that don't use it and
    add an example showing off the version API and partial compilation.
 

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/c1c963ef/plugins/experimental/spdy/spdy.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/spdy/spdy.cc b/plugins/experimental/spdy/spdy.cc
index f7fbed8..1a83e2a 100644
--- a/plugins/experimental/spdy/spdy.cc
+++ b/plugins/experimental/spdy/spdy.cc
@@ -339,6 +339,23 @@ spdy_accept_io(TSCont contp, TSEvent ev, void * edata)
     return TS_EVENT_NONE;
 }
 
+static int
+spdy_setup_protocol(TSCont /* contp ATS_UNUSED */, TSEvent ev, void * /* edata ATS_UNUSED
*/)
+{
+  switch (ev) {
+  case TS_EVENT_LIFECYCLE_PORTS_INITIALIZED:
+    TSReleaseAssert(TSNetAcceptNamedProtocol(TSContCreate(spdy_accept_io, TSMutexCreate()),
+                                             TS_NPN_PROTOCOL_SPDY_2) == TS_SUCCESS);
+    debug_plugin("registered named protocol endpoint for %s", TS_NPN_PROTOCOL_SPDY_2);
+    break;
+  default:
+    TSError("[spdy] Protocol registration failed");
+    break;
+  }
+
+  return TS_EVENT_NONE;
+}
+
 extern "C" void
 TSPluginInit(int argc, const char * argv[])
 {
@@ -372,12 +389,7 @@ TSPluginInit(int argc, const char * argv[])
     }
 
 init:
-    TSReleaseAssert(
-        TSNetAcceptNamedProtocol(TSContCreate(spdy_accept_io, TSMutexCreate()),
-        TS_NPN_PROTOCOL_SPDY_2) == TS_SUCCESS);
-
-    debug_plugin("registered named protocol endpoint for %s",
-            TS_NPN_PROTOCOL_SPDY_2);
+    TSLifecycleHookAdd(TS_LIFECYCLE_PORTS_INITIALIZED_HOOK, TSContCreate(spdy_setup_protocol,
NULL));
 }
 
 /* vim: set sw=4 tw=79 ts=4 et ai : */


Mime
View raw message