# HG changeset patch # User jbe # Date 1429052392 -7200 # Node ID 89fc89b22e280983b3fcdb395151b7c7d20d6fe4 # Parent ee98e12427a9c18494d58183cdd82ed741dbdf82 Example application uses new "main" protocol; Handler for "main" gets table with "main" set to true diff -r ee98e12427a9 -r 89fc89b22e28 example_application.lua --- a/example_application.lua Wed Apr 15 00:54:17 2015 +0200 +++ b/example_application.lua Wed Apr 15 00:59:52 2015 +0200 @@ -147,9 +147,8 @@ end listen{ - { proto = "interval", delay = 1 }, - connect = chat_server, - max_fork = 1 + { proto = "main" }, + connect = chat_server } listen{ diff -r ee98e12427a9 -r 89fc89b22e28 moonbridge.c --- a/moonbridge.c Wed Apr 15 00:54:17 2015 +0200 +++ b/moonbridge.c Wed Apr 15 00:59:52 2015 +0200 @@ -794,11 +794,16 @@ lua_rawgetp(L, LUA_REGISTRYINDEX, moonbr_luakey_connect_func(pool)); if (fd < 0) { lua_newtable(L); - lua_pushstring(L, - listener->type_specific.interval.name ? - listener->type_specific.interval.name : "" - ); - lua_setfield(L, -2, "interval"); + if (listener->proto == MOONBR_PROTO_MAIN) { + lua_pushboolean(L, 1); + lua_setfield(L, -2, "main"); + } else if (listener->proto == MOONBR_PROTO_INTERVAL) { + lua_pushstring(L, + listener->type_specific.interval.name ? + listener->type_specific.interval.name : "" + ); + lua_setfield(L, -2, "interval"); + } } else { lua_pushvalue(L, -2); }