diff --git a/Makefile b/Makefile index 659d40b..6b80b15 100644 --- a/Makefile +++ b/Makefile @@ -14,9 +14,9 @@ LUA_STATICLIB := ./skynet/3rd/lua/liblua.a LUA_LIB ?= $(LUA_STATICLIB) LUA_INC ?= ./skynet/3rd/lua -LUA_CLIB = cjson websocketnetpack clientwebsocket +LUA_CLIB = cjson websocketnetpack clientwebsocket lfs -all : $(LUA_CLIB_PATH)/cjson.so $(LUA_CLIB_PATH)/websocketnetpack.so $(LUA_CLIB_PATH)/clientwebsocket.so +all : $(LUA_CLIB_PATH)/cjson.so $(LUA_CLIB_PATH)/websocketnetpack.so $(LUA_CLIB_PATH)/clientwebsocket.so $(LUA_CLIB_PATH)/lfs.so $(LUA_CLIB_PATH)/cjson.so : lua-cjson/fpconv.c lua-cjson/strbuf.c lua-cjson/lua_cjson.c | $(LUA_CLIB_PATH) $(CC) $(CFLAGS) $(SHARED) -Ilua-cjson $^ -o $@ @@ -27,6 +27,9 @@ $(LUA_CLIB_PATH)/websocketnetpack.so : lualib-src/lua-websocketnetpack.c | $(LUA $(LUA_CLIB_PATH)/clientwebsocket.so : lualib-src/lua-clientwebsocket.c | $(LUA_CLIB_PATH) $(CC) $(CFLAGS) $(SHARED) $^ -o $@ -lpthread +$(LUA_CLIB_PATH)/lfs.so : luafilesystem/src/lfs.c | $(LUA_CLIB_PATH) + $(CC) $(CFLAGS) $(SHARED) -Iluafilesystem/src $^ -o $@ + clean : rm -f $(LUA_CLIB_PATH)/*.so diff --git a/config/data/test.lua b/config/data/test.lua new file mode 100644 index 0000000..e69de29 diff --git a/config/item.lua b/config/item.lua index 01587d2..1d600a0 100644 --- a/config/item.lua +++ b/config/item.lua @@ -1,5 +1,5 @@ return { - [1] = {id=1, desc = "this is ggggttttitem one"}, + [1] = {id=1, desc = "this is item one"}, [2] = {id=1, desc = "this is item two"}, } diff --git a/config/ll b/config/ll new file mode 100644 index 0000000..e69de29 diff --git a/etc/config b/etc/config index 35f08b8..bc56050 100644 --- a/etc/config +++ b/etc/config @@ -14,7 +14,7 @@ nodename = "node1" --logger = "logd" --logservice = "snlua" ---logfilename = "test" +--logfilename = "logtest" --logfilemaxline = 2 diff --git a/etc/runconfig.lua b/etc/runconfig.lua index c4aa807..ca669fc 100644 --- a/etc/runconfig.lua +++ b/etc/runconfig.lua @@ -4,7 +4,7 @@ return { node1 = { -- 当前节点控制台监听端口 - debug_console_port = 8801, + debug_console_port = 8701, -- agent 池配置 agentpool = { name = "agent", -- 要启动缓存的 agent 文件名 @@ -24,7 +24,7 @@ return { login_num = 2, watchdog = { - port = 8899, + port = 8799, maxclient = 1024, nodelay = true, } diff --git a/log/test_2017-06-10_09:37:47 b/log/test_2017-06-10_09:37:47 deleted file mode 100644 index 7588eed..0000000 --- a/log/test_2017-06-10_09:37:47 +++ /dev/null @@ -1 +0,0 @@ -:00000002[2017-06-10 09:37:47.18]: KILL self diff --git a/log/test_2017-06-10_09:38:09 b/log/test_2017-06-10_09:38:09 deleted file mode 100644 index 1002e36..0000000 --- a/log/test_2017-06-10_09:38:09 +++ /dev/null @@ -1 +0,0 @@ -:00000002[2017-06-10 09:38:09.05]: KILL self diff --git a/log/test_2017-06-10_09:39:16 b/log/test_2017-06-10_09:39:16 deleted file mode 100644 index 8f85823..0000000 --- a/log/test_2017-06-10_09:39:16 +++ /dev/null @@ -1,2 +0,0 @@ -:00000008[2017-06-10 09:39:16.83]: Server start -:00000008[2017-06-10 09:39:16.83]: test log diff --git a/logtest b/logtest new file mode 100644 index 0000000..16aa28e --- /dev/null +++ b/logtest @@ -0,0 +1,282 @@ +:00000003[2017-06-19 15:59:48.00]: LAUNCH snlua launcher +:00000004[2017-06-19 15:59:48.00]: LAUNCH snlua cdummy +:00000005[2017-06-19 15:59:48.00]: LAUNCH harbor 0 4 +:00000006[2017-06-19 15:59:48.00]: LAUNCH snlua datacenterd +:00000007[2017-06-19 15:59:48.00]: LAUNCH snlua service_mgr +:00000008[2017-06-19 15:59:48.00]: LAUNCH snlua main +:00000009[2017-06-19 15:59:48.00]: LAUNCH snlua service_provider +:0000000a[2017-06-19 15:59:48.00]: LAUNCH snlua service_cell datasheet +:00000008[2017-06-19 15:59:48.00]: Server start version: 1.0.0 +:0000000b[2017-06-19 15:59:48.00]: LAUNCH snlua debug_console 8701 +:0000000b[2017-06-19 15:59:48.01]: Start debug console at 127.0.0.1:8701 +:00000008[2017-06-19 15:59:48.01]: start debug_console in port: 8701 +:00000008[2017-06-19 15:59:48.01]: start setupd... +:0000000c[2017-06-19 15:59:48.01]: LAUNCH snlua setupd +:0000000c[2017-06-19 15:59:48.01]: init test conf +:0000000c[2017-06-19 15:59:48.01]: init item conf +:00000008[2017-06-19 15:59:48.01]: start dbproxyd... +:0000000d[2017-06-19 15:59:48.01]: LAUNCH snlua dbproxyd +:0000000d[2017-06-19 15:59:48.02]: Connect to 127.0.0.1:27017 failed (Connection refused) +:0000000e[2017-06-19 15:59:48.02]: LAUNCH snlua dbproxyd +:0000000e[2017-06-19 15:59:48.02]: Connect to 127.0.0.1:27017 failed (Connection refused) +:00000008[2017-06-19 15:59:48.02]: start centerd... +:0000000f[2017-06-19 15:59:48.02]: LAUNCH snlua centerd +:00000010[2017-06-19 15:59:48.02]: LAUNCH snlua centerd +:00000008[2017-06-19 15:59:48.02]: start logind... +:00000011[2017-06-19 15:59:48.02]: LAUNCH snlua logind +:00000011[2017-06-19 15:59:48.02]: init libdbproxy +:00000012[2017-06-19 15:59:48.02]: LAUNCH snlua logind +:00000012[2017-06-19 15:59:48.02]: init libdbproxy +:00000008[2017-06-19 15:59:48.02]: start agent pool... +:00000013[2017-06-19 15:59:48.02]: LAUNCH snlua agentpool wsagent 10 2 10 +:00000014[2017-06-19 15:59:48.02]: LAUNCH snlua wsagent 10 +:00000014[2017-06-19 15:59:48.02]: init libdbproxy +:00000015[2017-06-19 15:59:48.02]: LAUNCH snlua wsagent 10 +:00000015[2017-06-19 15:59:48.02]: init libdbproxy +:00000016[2017-06-19 15:59:48.02]: LAUNCH snlua wsagent 10 +:00000016[2017-06-19 15:59:48.02]: init libdbproxy +:00000017[2017-06-19 15:59:48.02]: LAUNCH snlua wsagent 10 +:00000017[2017-06-19 15:59:48.02]: init libdbproxy +:00000018[2017-06-19 15:59:48.02]: LAUNCH snlua wsagent 10 +:00000018[2017-06-19 15:59:48.02]: init libdbproxy +:00000019[2017-06-19 15:59:48.02]: LAUNCH snlua wsagent 10 +:00000019[2017-06-19 15:59:48.02]: init libdbproxy +:0000001a[2017-06-19 15:59:48.03]: LAUNCH snlua wsagent 10 +:0000001a[2017-06-19 15:59:48.03]: init libdbproxy +:0000001b[2017-06-19 15:59:48.03]: LAUNCH snlua wsagent 10 +:0000001b[2017-06-19 15:59:48.03]: init libdbproxy +:0000001c[2017-06-19 15:59:48.03]: LAUNCH snlua wsagent 10 +:0000001c[2017-06-19 15:59:48.03]: init libdbproxy +:0000001d[2017-06-19 15:59:48.03]: LAUNCH snlua wsagent 10 +:0000001d[2017-06-19 15:59:48.03]: init libdbproxy +:0000001e[2017-06-19 15:59:48.03]: LAUNCH snlua wswatchdog +:0000001e[2017-06-19 15:59:48.03]: init liblogin +:0000001f[2017-06-19 15:59:48.03]: LAUNCH snlua wsgate +:0000001f[2017-06-19 15:59:48.03]: Listen on 0.0.0.0:8799 +:00000008[2017-06-19 15:59:48.03]: start wswatchdog in port: 8799 +:00000008[2017-06-19 15:59:48.03]: KILL self +:00000002[2017-06-19 15:59:48.03]: KILL self +:00000003[2017-06-19 16:02:09.89]: LAUNCH snlua launcher +:00000004[2017-06-19 16:02:09.89]: LAUNCH snlua cdummy +:00000005[2017-06-19 16:02:09.89]: LAUNCH harbor 0 4 +:00000006[2017-06-19 16:02:09.89]: LAUNCH snlua datacenterd +:00000007[2017-06-19 16:02:09.89]: LAUNCH snlua service_mgr +:00000008[2017-06-19 16:02:09.89]: LAUNCH snlua main +:00000009[2017-06-19 16:02:09.89]: LAUNCH snlua service_provider +:0000000a[2017-06-19 16:02:09.89]: LAUNCH snlua service_cell datasheet +:00000008[2017-06-19 16:02:09.09]: Server start version: 1.0.0 +:0000000b[2017-06-19 16:02:09.09]: LAUNCH snlua debug_console 8701 +:0000000b[2017-06-19 16:02:09.09]: Start debug console at 127.0.0.1:8701 +:00000008[2017-06-19 16:02:09.91]: start debug_console in port: 8701 +:00000008[2017-06-19 16:02:09.91]: start setupd... +:0000000c[2017-06-19 16:02:09.91]: LAUNCH snlua setupd +:0000000c[2017-06-19 16:02:09.91]: init test conf +:0000000c[2017-06-19 16:02:09.91]: init item conf +:00000008[2017-06-19 16:02:09.91]: start dbproxyd... +:0000000d[2017-06-19 16:02:09.91]: LAUNCH snlua dbproxyd +:0000000e[2017-06-19 16:02:09.91]: LAUNCH snlua dbproxyd +:00000008[2017-06-19 16:02:09.91]: start centerd... +:0000000f[2017-06-19 16:02:09.91]: LAUNCH snlua centerd +:00000010[2017-06-19 16:02:09.91]: LAUNCH snlua centerd +:00000008[2017-06-19 16:02:09.91]: start logind... +:00000011[2017-06-19 16:02:09.91]: LAUNCH snlua logind +:00000011[2017-06-19 16:02:09.91]: init libdbproxy +:00000012[2017-06-19 16:02:09.91]: LAUNCH snlua logind +:00000012[2017-06-19 16:02:09.91]: init libdbproxy +:00000008[2017-06-19 16:02:09.91]: start agent pool... +:00000013[2017-06-19 16:02:09.91]: LAUNCH snlua agentpool wsagent 10 2 10 +:00000014[2017-06-19 16:02:09.91]: LAUNCH snlua wsagent 10 +:00000014[2017-06-19 16:02:09.91]: init libdbproxy +:00000015[2017-06-19 16:02:09.91]: LAUNCH snlua wsagent 10 +:00000015[2017-06-19 16:02:09.91]: init libdbproxy +:00000016[2017-06-19 16:02:09.91]: LAUNCH snlua wsagent 10 +:00000016[2017-06-19 16:02:09.91]: init libdbproxy +:00000017[2017-06-19 16:02:09.92]: LAUNCH snlua wsagent 10 +:00000017[2017-06-19 16:02:09.92]: init libdbproxy +:00000018[2017-06-19 16:02:09.92]: LAUNCH snlua wsagent 10 +:00000018[2017-06-19 16:02:09.92]: init libdbproxy +:00000019[2017-06-19 16:02:09.92]: LAUNCH snlua wsagent 10 +:00000019[2017-06-19 16:02:09.92]: init libdbproxy +:0000001a[2017-06-19 16:02:09.92]: LAUNCH snlua wsagent 10 +:0000001a[2017-06-19 16:02:09.92]: init libdbproxy +:0000001b[2017-06-19 16:02:09.92]: LAUNCH snlua wsagent 10 +:0000001b[2017-06-19 16:02:09.92]: init libdbproxy +:0000001c[2017-06-19 16:02:09.92]: LAUNCH snlua wsagent 10 +:0000001c[2017-06-19 16:02:09.92]: init libdbproxy +:0000001d[2017-06-19 16:02:09.92]: LAUNCH snlua wsagent 10 +:0000001d[2017-06-19 16:02:09.92]: init libdbproxy +:0000001e[2017-06-19 16:02:09.92]: LAUNCH snlua wswatchdog +:0000001e[2017-06-19 16:02:09.92]: init liblogin +:0000001f[2017-06-19 16:02:09.92]: LAUNCH snlua wsgate +:0000001f[2017-06-19 16:02:09.92]: Listen on 0.0.0.0:8799 +:00000008[2017-06-19 16:02:09.92]: start wswatchdog in port: 8799 +:00000008[2017-06-19 16:02:09.92]: KILL self +:00000002[2017-06-19 16:02:09.92]: KILL self +:00000003[2017-06-19 16:02:18.33]: LAUNCH snlua launcher +:00000004[2017-06-19 16:02:18.33]: LAUNCH snlua cdummy +:00000005[2017-06-19 16:02:18.33]: LAUNCH harbor 0 4 +:00000006[2017-06-19 16:02:18.33]: LAUNCH snlua datacenterd +:00000007[2017-06-19 16:02:18.33]: LAUNCH snlua service_mgr +:00000008[2017-06-19 16:02:18.33]: LAUNCH snlua main +:00000009[2017-06-19 16:02:18.35]: LAUNCH snlua service_provider +:0000000a[2017-06-19 16:02:18.35]: LAUNCH snlua service_cell datasheet +:00000008[2017-06-19 16:02:18.35]: Server start version: 1.0.0 +:0000000b[2017-06-19 16:02:18.35]: LAUNCH snlua debug_console 8701 +:0000000b[2017-06-19 16:02:18.35]: Start debug console at 127.0.0.1:8701 +:00000008[2017-06-19 16:02:18.36]: start debug_console in port: 8701 +:00000008[2017-06-19 16:02:18.36]: start setupd... +:0000000c[2017-06-19 16:02:18.36]: LAUNCH snlua setupd +:0000000c[2017-06-19 16:02:18.36]: init test conf +:0000000c[2017-06-19 16:02:18.36]: init item conf +:00000008[2017-06-19 16:02:18.36]: start dbproxyd... +:0000000d[2017-06-19 16:02:18.36]: LAUNCH snlua dbproxyd +:0000000e[2017-06-19 16:02:18.36]: LAUNCH snlua dbproxyd +:00000008[2017-06-19 16:02:18.37]: start centerd... +:0000000f[2017-06-19 16:02:18.37]: LAUNCH snlua centerd +:00000010[2017-06-19 16:02:18.37]: LAUNCH snlua centerd +:00000008[2017-06-19 16:02:18.37]: start logind... +:00000011[2017-06-19 16:02:18.37]: LAUNCH snlua logind +:00000011[2017-06-19 16:02:18.37]: init libdbproxy +:00000012[2017-06-19 16:02:18.37]: LAUNCH snlua logind +:00000012[2017-06-19 16:02:18.37]: init libdbproxy +:00000008[2017-06-19 16:02:18.37]: start agent pool... +:00000013[2017-06-19 16:02:18.37]: LAUNCH snlua agentpool wsagent 10 2 10 +:00000014[2017-06-19 16:02:18.37]: LAUNCH snlua wsagent 10 +:00000014[2017-06-19 16:02:18.37]: init libdbproxy +:00000015[2017-06-19 16:02:18.37]: LAUNCH snlua wsagent 10 +:00000015[2017-06-19 16:02:18.37]: init libdbproxy +:00000016[2017-06-19 16:02:18.37]: LAUNCH snlua wsagent 10 +:00000016[2017-06-19 16:02:18.37]: init libdbproxy +:00000017[2017-06-19 16:02:18.37]: LAUNCH snlua wsagent 10 +:00000017[2017-06-19 16:02:18.37]: init libdbproxy +:00000018[2017-06-19 16:02:18.38]: LAUNCH snlua wsagent 10 +:00000018[2017-06-19 16:02:18.38]: init libdbproxy +:00000019[2017-06-19 16:02:18.38]: LAUNCH snlua wsagent 10 +:00000019[2017-06-19 16:02:18.38]: init libdbproxy +:0000001a[2017-06-19 16:02:18.38]: LAUNCH snlua wsagent 10 +:0000001a[2017-06-19 16:02:18.38]: init libdbproxy +:0000001b[2017-06-19 16:02:18.38]: LAUNCH snlua wsagent 10 +:0000001b[2017-06-19 16:02:18.38]: init libdbproxy +:0000001c[2017-06-19 16:02:18.38]: LAUNCH snlua wsagent 10 +:0000001c[2017-06-19 16:02:18.38]: init libdbproxy +:0000001d[2017-06-19 16:02:18.38]: LAUNCH snlua wsagent 10 +:0000001d[2017-06-19 16:02:18.38]: init libdbproxy +:0000001e[2017-06-19 16:02:18.38]: LAUNCH snlua wswatchdog +:0000001e[2017-06-19 16:02:18.38]: init liblogin +:0000001f[2017-06-19 16:02:18.39]: LAUNCH snlua wsgate +:0000001f[2017-06-19 16:02:18.39]: Listen on 0.0.0.0:8799 +:00000008[2017-06-19 16:02:18.39]: start wswatchdog in port: 8799 +:00000008[2017-06-19 16:02:18.39]: KILL self +:00000002[2017-06-19 16:02:18.39]: KILL self +:00000003[2017-06-19 16:02:30.88]: LAUNCH snlua launcher +:00000004[2017-06-19 16:02:30.88]: LAUNCH snlua cdummy +:00000005[2017-06-19 16:02:30.88]: LAUNCH harbor 0 4 +:00000006[2017-06-19 16:02:30.88]: LAUNCH snlua datacenterd +:00000007[2017-06-19 16:02:30.88]: LAUNCH snlua service_mgr +:00000008[2017-06-19 16:02:30.88]: LAUNCH snlua main +:00000009[2017-06-19 16:02:30.88]: LAUNCH snlua service_provider +:0000000a[2017-06-19 16:02:30.88]: LAUNCH snlua service_cell datasheet +:00000008[2017-06-19 16:02:30.88]: Server start version: 1.0.0 +:0000000b[2017-06-19 16:02:30.88]: LAUNCH snlua debug_console 8701 +:0000000b[2017-06-19 16:02:30.89]: Start debug console at 127.0.0.1:8701 +:00000008[2017-06-19 16:02:30.89]: start debug_console in port: 8701 +:00000008[2017-06-19 16:02:30.89]: start setupd... +:0000000c[2017-06-19 16:02:30.89]: LAUNCH snlua setupd +:0000000c[2017-06-19 16:02:30.89]: init test conf +:0000000c[2017-06-19 16:02:30.89]: init item conf +:00000008[2017-06-19 16:02:30.89]: start dbproxyd... +:0000000d[2017-06-19 16:02:30.89]: LAUNCH snlua dbproxyd +:0000000e[2017-06-19 16:02:30.09]: LAUNCH snlua dbproxyd +:00000008[2017-06-19 16:02:30.09]: start centerd... +:0000000f[2017-06-19 16:02:30.09]: LAUNCH snlua centerd +:00000010[2017-06-19 16:02:30.09]: LAUNCH snlua centerd +:00000008[2017-06-19 16:02:30.09]: start logind... +:00000011[2017-06-19 16:02:30.09]: LAUNCH snlua logind +:00000011[2017-06-19 16:02:30.09]: init libdbproxy +:00000012[2017-06-19 16:02:30.09]: LAUNCH snlua logind +:00000012[2017-06-19 16:02:30.09]: init libdbproxy +:00000008[2017-06-19 16:02:30.09]: start agent pool... +:00000013[2017-06-19 16:02:30.09]: LAUNCH snlua agentpool wsagent 10 2 10 +:00000014[2017-06-19 16:02:30.09]: LAUNCH snlua wsagent 10 +:00000014[2017-06-19 16:02:30.09]: init libdbproxy +:00000015[2017-06-19 16:02:30.09]: LAUNCH snlua wsagent 10 +:00000015[2017-06-19 16:02:30.09]: init libdbproxy +:00000016[2017-06-19 16:02:30.09]: LAUNCH snlua wsagent 10 +:00000016[2017-06-19 16:02:30.09]: init libdbproxy +:00000017[2017-06-19 16:02:30.09]: LAUNCH snlua wsagent 10 +:00000017[2017-06-19 16:02:30.09]: init libdbproxy +:00000018[2017-06-19 16:02:30.09]: LAUNCH snlua wsagent 10 +:00000018[2017-06-19 16:02:30.09]: init libdbproxy +:00000019[2017-06-19 16:02:30.09]: LAUNCH snlua wsagent 10 +:00000019[2017-06-19 16:02:30.09]: init libdbproxy +:0000001a[2017-06-19 16:02:30.09]: LAUNCH snlua wsagent 10 +:0000001a[2017-06-19 16:02:30.09]: init libdbproxy +:0000001b[2017-06-19 16:02:30.09]: LAUNCH snlua wsagent 10 +:0000001b[2017-06-19 16:02:30.09]: init libdbproxy +:0000001c[2017-06-19 16:02:30.91]: LAUNCH snlua wsagent 10 +:0000001c[2017-06-19 16:02:30.91]: init libdbproxy +:0000001d[2017-06-19 16:02:30.91]: LAUNCH snlua wsagent 10 +:0000001d[2017-06-19 16:02:30.91]: init libdbproxy +:0000001e[2017-06-19 16:02:30.91]: LAUNCH snlua wswatchdog +:0000001e[2017-06-19 16:02:30.91]: init liblogin +:0000001f[2017-06-19 16:02:30.91]: LAUNCH snlua wsgate +:0000001f[2017-06-19 16:02:30.91]: Listen on 0.0.0.0:8799 +:00000008[2017-06-19 16:02:30.91]: start wswatchdog in port: 8799 +:00000008[2017-06-19 16:02:30.91]: KILL self +:00000002[2017-06-19 16:02:30.91]: KILL self +:00000003[2017-06-19 16:02:49.18]: LAUNCH snlua launcher +:00000004[2017-06-19 16:02:49.18]: LAUNCH snlua cdummy +:00000005[2017-06-19 16:02:49.18]: LAUNCH harbor 0 4 +:00000006[2017-06-19 16:02:49.18]: LAUNCH snlua datacenterd +:00000007[2017-06-19 16:02:49.18]: LAUNCH snlua service_mgr +:00000008[2017-06-19 16:02:49.18]: LAUNCH snlua main +:00000009[2017-06-19 16:02:49.18]: LAUNCH snlua service_provider +:0000000a[2017-06-19 16:02:49.18]: LAUNCH snlua service_cell datasheet +:00000008[2017-06-19 16:02:49.18]: Server start version: 1.0.0 +:0000000b[2017-06-19 16:02:49.18]: LAUNCH snlua debug_console 8701 +:0000000b[2017-06-19 16:02:49.19]: Start debug console at 127.0.0.1:8701 +:00000008[2017-06-19 16:02:49.19]: start debug_console in port: 8701 +:00000008[2017-06-19 16:02:49.19]: start setupd... +:0000000c[2017-06-19 16:02:49.19]: LAUNCH snlua setupd +:0000000c[2017-06-19 16:02:49.19]: init test conf +:0000000c[2017-06-19 16:02:49.19]: init item conf +:00000008[2017-06-19 16:02:49.19]: start dbproxyd... +:0000000d[2017-06-19 16:02:49.19]: LAUNCH snlua dbproxyd +:0000000e[2017-06-19 16:02:49.02]: LAUNCH snlua dbproxyd +:00000008[2017-06-19 16:02:49.02]: start centerd... +:0000000f[2017-06-19 16:02:49.02]: LAUNCH snlua centerd +:00000010[2017-06-19 16:02:49.02]: LAUNCH snlua centerd +:00000008[2017-06-19 16:02:49.02]: start logind... +:00000011[2017-06-19 16:02:49.02]: LAUNCH snlua logind +:00000011[2017-06-19 16:02:49.02]: init libdbproxy +:00000012[2017-06-19 16:02:49.02]: LAUNCH snlua logind +:00000012[2017-06-19 16:02:49.02]: init libdbproxy +:00000008[2017-06-19 16:02:49.02]: start agent pool... +:00000013[2017-06-19 16:02:49.02]: LAUNCH snlua agentpool wsagent 10 2 10 +:00000014[2017-06-19 16:02:49.02]: LAUNCH snlua wsagent 10 +:00000014[2017-06-19 16:02:49.02]: init libdbproxy +:00000015[2017-06-19 16:02:49.02]: LAUNCH snlua wsagent 10 +:00000015[2017-06-19 16:02:49.02]: init libdbproxy +:00000016[2017-06-19 16:02:49.02]: LAUNCH snlua wsagent 10 +:00000016[2017-06-19 16:02:49.02]: init libdbproxy +:00000017[2017-06-19 16:02:49.02]: LAUNCH snlua wsagent 10 +:00000017[2017-06-19 16:02:49.02]: init libdbproxy +:00000018[2017-06-19 16:02:49.02]: LAUNCH snlua wsagent 10 +:00000018[2017-06-19 16:02:49.02]: init libdbproxy +:00000019[2017-06-19 16:02:49.02]: LAUNCH snlua wsagent 10 +:00000019[2017-06-19 16:02:49.22]: init libdbproxy +:0000001a[2017-06-19 16:02:49.22]: LAUNCH snlua wsagent 10 +:0000001a[2017-06-19 16:02:49.22]: init libdbproxy +:0000001b[2017-06-19 16:02:49.22]: LAUNCH snlua wsagent 10 +:0000001b[2017-06-19 16:02:49.22]: init libdbproxy +:0000001c[2017-06-19 16:02:49.22]: LAUNCH snlua wsagent 10 +:0000001c[2017-06-19 16:02:49.22]: init libdbproxy +:0000001d[2017-06-19 16:02:49.22]: LAUNCH snlua wsagent 10 +:0000001d[2017-06-19 16:02:49.22]: init libdbproxy +:0000001e[2017-06-19 16:02:49.22]: LAUNCH snlua wswatchdog +:0000001e[2017-06-19 16:02:49.22]: init liblogin +:0000001f[2017-06-19 16:02:49.22]: LAUNCH snlua wsgate +:0000001f[2017-06-19 16:02:49.22]: Listen on 0.0.0.0:8799 +:00000008[2017-06-19 16:02:49.22]: start wswatchdog in port: 8799 +:00000008[2017-06-19 16:02:49.22]: KILL self +:00000002[2017-06-19 16:02:49.22]: KILL self diff --git a/luafilesystem b/luafilesystem new file mode 160000 index 0000000..3c4e563 --- /dev/null +++ b/luafilesystem @@ -0,0 +1 @@ +Subproject commit 3c4e563d9c140319e28c419f2710b51a2f6d6d24 diff --git a/lualib/lfstool.lua b/lualib/lfstool.lua new file mode 100644 index 0000000..ef82ee4 --- /dev/null +++ b/lualib/lfstool.lua @@ -0,0 +1,26 @@ +local lfs = require "lfs" + +local M = {} + + +local sep = string.match (package.config, "[^\n]+") +function M.attrdir(path) + for file in lfs.dir(path) do + if file ~= "." and file ~= ".." then + local f = path .. sep .. file + print("\t=> " .. f .. " <=") + local attr = lfs.attributes(f) + assert(type(attr) == "table") + if attr.mode == "directory" then + M.attrdir(f) + else + for name, value in pairs(attr) do + print(name, value) + end + end + end + end +end + +return M + diff --git a/lualib/libwsagentpool.lua b/lualib/libwsagentpool.lua new file mode 100644 index 0000000..8aa354f --- /dev/null +++ b/lualib/libwsagentpool.lua @@ -0,0 +1,23 @@ +local skynet = require "skynet" + +local M = {} + +local agentpool +local function init() + agentpool = skynet.queryservice("agentpool") +end + + +function M.get() + return skynet.call(agentpool, "lua", "get") +end + +function M.recycle(agent) + return skynet.call(agentpool, "lua", "recycle", agent) +end + +skynet.init(init) + +return M + + diff --git a/lualib/setup.lua b/lualib/setup.lua index 70a0c9f..8a2cf81 100644 --- a/lualib/setup.lua +++ b/lualib/setup.lua @@ -6,27 +6,36 @@ local env = require "env" local M = env.dispatch -local list = { - "test", - "item", -} - local function update() skynet.timeout(100, function() - print("update all") M.update_all() update() end ) end +local function dir(path) + local lfs = require "lfs" + local ret = {} + for file in lfs.dir(path) do + if file ~= "." and file ~= ".." then + local file = string.match(file, "(%w+)%.lua") + if file then + table.insert(ret, file) + end + end + end + return ret +end + local reload = require "reload" local function init() + local list = dir("config") for k, v in pairs(list) do + log.debug("init " .. v .. " conf") local conf = reload.loadmod(v) builder.new(v, conf) end - update() end @@ -34,13 +43,17 @@ function M.update_all() for k, v in pairs(list) do local conf = reload.loadmod(v) builder.update(v, conf) + log.debug("update conf: " .. v) end end function M.update(name) - local conf = require(name) - builder.update(v, conf) + local conf = reload.loadmod(name) + builder.update(name, conf) + log.debug("update conf: " .. name) end skynet.init(init) + + diff --git a/run/skynet.log b/run/skynet.log deleted file mode 100644 index 56fa0cf..0000000 --- a/run/skynet.log +++ /dev/null @@ -1,34 +0,0 @@ -[:00000001] LAUNCH logger /Users/uiyiu/work/server/zServer/zServer/run/skynet.log -[:00000002] LAUNCH snlua bootstrap -[:00000003] LAUNCH snlua launcher -[:00000004] LAUNCH snlua cdummy -[:00000005] LAUNCH harbor 0 4 -[:00000006] LAUNCH snlua datacenterd -[:00000007] LAUNCH snlua service_mgr -[:00000008] LAUNCH snlua main -[:00000008] init service failed: ...yiu/work/server/zServer/zServer/skynet/lualib/skynet.lua:361: attempt to index a nil value (local 'p') -stack traceback: - ...yiu/work/server/zServer/zServer/skynet/lualib/skynet.lua:361: in function 'skynet.send' - /Users/uiyiu/work/server/zServer/zServer/lualib/liblog.lua:5: in function 'liblog.debug' - /Users/uiyiu/work/server/zServer/zServer/service/main.lua:5: in local 'start' - ...yiu/work/server/zServer/zServer/skynet/lualib/skynet.lua:619: in function <...yiu/work/server/zServer/zServer/skynet/lualib/skynet.lua:616> - [C]: in function 'xpcall' - ...yiu/work/server/zServer/zServer/skynet/lualib/skynet.lua:623: in function 'skynet.pcall' - ...yiu/work/server/zServer/zServer/skynet/lualib/skynet.lua:627: in function 'skynet.init_service' - ...yiu/work/server/zServer/zServer/skynet/lualib/skynet.lua:640: in upvalue 'f' - ...yiu/work/server/zServer/zServer/skynet/lualib/skynet.lua:104: in function <...yiu/work/server/zServer/zServer/skynet/lualib/skynet.lua:103> -[:00000008] KILL self -[:00000002] KILL self -[:00000000] time diff error: change from 149701296609 to 149701296639 -[:00000000] time diff error: change from 149703484473 to 149703484541 -[:00000000] time diff error: change from 149706306401 to 149706306417 -[:00000000] time diff error: change from 149709561734 to 149709561819 -[:00000000] time diff error: change from 149711395438 to 149711395556 -[:00000000] time diff error: change from 149713764550 to 149713764607 -[:00000000] time diff error: change from 149715479671 to 149715479694 -[:00000000] time diff error: change from 149723735499 to 149723735780 -[:00000000] time diff error: change from 149725435976 to 149725435997 -[:00000000] time diff error: change from 149729950040 to 149729950151 -[:00000000] time diff error: change from 149732270322 to 149732270402 -[:00000000] time diff error: change from 149734009160 to 149734009255 -[:00000000] time diff error: change from 149740355994 to 149740356163 diff --git a/run/skynet.pid b/run/skynet.pid deleted file mode 100644 index bc09b9d..0000000 --- a/run/skynet.pid +++ /dev/null @@ -1 +0,0 @@ -23111 diff --git a/service/dbproxyd.lua b/service/dbproxyd.lua index a603968..b2f1333 100644 --- a/service/dbproxyd.lua +++ b/service/dbproxyd.lua @@ -1,3 +1,3 @@ -require "service" +require "service" require "dbproxy" diff --git a/service/main.lua b/service/main.lua index 9fb6e9f..182af07 100644 --- a/service/main.lua +++ b/service/main.lua @@ -13,6 +13,9 @@ skynet.start(function() skynet.uniqueservice("debug_console", nodeconf.debug_console_port) log.debug("start debug_console in port: " .. nodeconf.debug_console_port) + log.debug("start setupd...") + skynet.newservice("setupd") + log.debug("start dbproxyd...") for i = 1, nodeconf.dbproxy_num do local name = string.format(".dbproxyd%d", i) diff --git a/test.lua b/test.lua index 2244c7e..728fd5c 100644 --- a/test.lua +++ b/test.lua @@ -13,6 +13,7 @@ function string.split(input, delimiter) return arr end + local t = string.split("hello.world", ".") for k, v in pairs(t) do print("v: " .. v)