aboutsummaryrefslogtreecommitdiffstats
path: root/epan/wslua/wslua_proto.c
diff options
context:
space:
mode:
authorStig Bjørlykke <stig@bjorlykke.org>2014-10-31 13:21:46 +0100
committerStig Bjørlykke <stig@bjorlykke.org>2014-11-04 07:52:21 +0000
commit15e78de432f55f5478f1b3994f3d7e060b60508d (patch)
tree9676ec10a63d7913b7af4048ff6948516daae0a5 /epan/wslua/wslua_proto.c
parente2f2e18e634938d167aef2faa42340f3877663f4 (diff)
Lua: Register dissectors only once.
Change-Id: I883e8560e9d101d34760d09715255e4fccc9eb98 Reviewed-on: https://code.wireshark.org/review/5022 Reviewed-by: Hadriel Kaplan <hadrielk@yahoo.com> Reviewed-by: Stig Bjørlykke <stig@bjorlykke.org> Tested-by: Stig Bjørlykke <stig@bjorlykke.org>
Diffstat (limited to 'epan/wslua/wslua_proto.c')
-rw-r--r--epan/wslua/wslua_proto.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/epan/wslua/wslua_proto.c b/epan/wslua/wslua_proto.c
index 382fe07862..f53135a7d0 100644
--- a/epan/wslua/wslua_proto.c
+++ b/epan/wslua/wslua_proto.c
@@ -1537,6 +1537,7 @@ WSLUA_CONSTRUCTOR Proto_new(lua_State* L) {
hiname = g_ascii_strup(name, -1);
proto->name = hiname;
+ proto->loname = loname;
proto->desc = g_strdup(desc);
proto->hfid = proto_register_protocol(proto->desc,hiname,loname);
proto->ett = -1;
@@ -1600,7 +1601,7 @@ WSLUA_FUNCTION wslua_register_postdissector(lua_State* L) {
if(!proto->is_postdissector) {
if (! proto->handle) {
- proto->handle = new_create_dissector_handle(dissect_lua, proto->hfid);
+ proto->handle = new_register_dissector(proto->loname, dissect_lua, proto->hfid);
}
register_postdissector(proto->handle);
@@ -1723,17 +1724,13 @@ static int Proto_set_dissector(lua_State* L) {
if (lua_isfunction(L,2)) {
/* insert the dissector into the dissectors table */
- gchar* loname = g_ascii_strdown(proto->name, -1);
-
lua_rawgeti(L, LUA_REGISTRYINDEX, lua_dissectors_table_ref);
lua_replace(L, 1);
lua_pushstring(L,proto->name);
lua_insert(L, 2); /* function is now at 3 */
lua_settable(L,1);
- proto->handle = new_create_dissector_handle(dissect_lua, proto->hfid);
-
- new_register_dissector(loname, dissect_lua, proto->hfid);
+ proto->handle = new_register_dissector(proto->loname, dissect_lua, proto->hfid);
} else {
luaL_argerror(L,2,"The dissector of a protocol must be a function");
}