You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@trafficserver.apache.org by zw...@apache.org on 2013/08/30 18:20:45 UTC

[32/50] git commit: TS-2154: Lua plugin asserts traffic_server on startup

TS-2154: Lua plugin asserts traffic_server on startup

The Lua plugin keep a number of per-instance hook tables. TS-1469
added a hook, but the Lua plugin was never updated, so we ended
passing a NULL continuation pointer to TSContDataSet() in
LuaPluginInstance::init(). Lets add the missing hook, and also add
a static assertion so that the next person do add a hook knows that
this requirement exists.


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

Branch: refs/heads/5.0.x
Commit: 45afcfac1089910570f69060cc6b2b35d9d19ad0
Parents: f2bfdce
Author: James Peach <jp...@apache.org>
Authored: Mon Aug 26 16:52:08 2013 -0700
Committer: James Peach <jp...@apache.org>
Committed: Mon Aug 26 16:55:04 2013 -0700

----------------------------------------------------------------------
 CHANGES                           | 2 ++
 plugins/experimental/lua/state.cc | 5 +++++
 2 files changed, 7 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/trafficserver/blob/45afcfac/CHANGES
----------------------------------------------------------------------
diff --git a/CHANGES b/CHANGES
index 7c41477..773bbaf 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,8 @@
 Changes with Apache Traffic Server 4.1.0
 
 
+  *) [TS-2154] Lua plugin asserts traffic_server on startup
+
   *) [TS-2158] Properly mark an IP as non-routable for IPv4 and IPv6 link local
    addresses as well as IPv6 private addresses and IPv4 Carrier Grade NAT
    addresses from RFC 6598.

http://git-wip-us.apache.org/repos/asf/trafficserver/blob/45afcfac/plugins/experimental/lua/state.cc
----------------------------------------------------------------------
diff --git a/plugins/experimental/lua/state.cc b/plugins/experimental/lua/state.cc
index 01d357e..502e6fd 100644
--- a/plugins/experimental/lua/state.cc
+++ b/plugins/experimental/lua/state.cc
@@ -29,6 +29,10 @@
 
 #define INVALID_INSTANCE_ID (instanceid_t)(-1)
 
+// InitDemuxTable() requires an initializer for every hook. Make sure that we don't
+// get out of sync with the number of hooks.
+extern void * __static_assert_hook_count[TS_HTTP_LAST_HOOK == 17 ? 0 : -1];
+
 typedef int (*LuaHookDemuxer)(TSHttpHookID, TSCont, TSEvent, void *);
 
 template <TSHttpHookID hookid, LuaHookDemuxer demuxer> int
@@ -57,6 +61,7 @@ InitDemuxTable(LuaPluginInstance::demux_table_t& table)
   table[TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK] = MakeLuaHook(demuxer, TS_HTTP_CACHE_LOOKUP_COMPLETE_HOOK);
   table[TS_HTTP_PRE_REMAP_HOOK]         = MakeLuaHook(demuxer, TS_HTTP_PRE_REMAP_HOOK);
   table[TS_HTTP_POST_REMAP_HOOK]        = MakeLuaHook(demuxer, TS_HTTP_POST_REMAP_HOOK);
+  table[TS_HTTP_RESPONSE_CLIENT_HOOK]   = MakeLuaHook(demuxer, TS_HTTP_RESPONSE_CLIENT_HOOK);
 }
 
 // Global storage for Lua plugin instances. We vend instanceid_t's as an index into