From a7d79831e697a8d49d725637392855504d070573 Mon Sep 17 00:00:00 2001 From: David Feng Date: Wed, 4 Mar 2015 15:14:35 +0800 Subject: [PATCH 1/3] remove redundant print and use skynet.error --- lualib/skynet.lua | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lualib/skynet.lua b/lualib/skynet.lua index e538a37b..21168c25 100644 --- a/lualib/skynet.lua +++ b/lualib/skynet.lua @@ -101,7 +101,6 @@ local coroutine_count = 0 local function co_create(f) local co = table.remove(coroutine_pool) if co == nil then - local print = print co = coroutine.create(function(...) f(...) while true do @@ -464,7 +463,7 @@ function skynet.dispatch_unknown_request(unknown) end local function unknown_response(session, address, msg, sz) - print("Response message :" , c.tostring(msg,sz)) + skynet.error(string.format("Response message :" , c.tostring(msg,sz))) error(string.format("Unknown session : %d from %x", session, address)) end From 4718a12668d4d96d6621b0dd54d743d8109e1237 Mon Sep 17 00:00:00 2001 From: David Feng Date: Wed, 4 Mar 2015 15:22:38 +0800 Subject: [PATCH 2/3] typo fix --- lualib-src/lua-skynet.c | 6 +++--- lualib/skynet.lua | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lualib-src/lua-skynet.c b/lualib-src/lua-skynet.c index ca3476d1..f1594f79 100644 --- a/lualib-src/lua-skynet.c +++ b/lualib-src/lua-skynet.c @@ -16,7 +16,7 @@ struct snlua { const char * preload; }; -static int +static int traceback (lua_State *L) { const char *msg = lua_tostring(L, 1); if (msg) @@ -191,7 +191,7 @@ _send(lua_State *L) { } if (session < 0) { // send to invalid address - // todo: maybe throw error whould be better + // todo: maybe throw an error would be better return 0; } lua_pushinteger(L,session); @@ -304,7 +304,7 @@ ltrash(lua_State *L) { int luaopen_skynet_core(lua_State *L) { luaL_checkversion(L); - + luaL_Reg l[] = { { "send" , _send }, { "genid", _genid }, diff --git a/lualib/skynet.lua b/lualib/skynet.lua index 21168c25..17f22bd3 100644 --- a/lualib/skynet.lua +++ b/lualib/skynet.lua @@ -22,7 +22,7 @@ local skynet = { PTYPE_HARBOR = 5, PTYPE_SOCKET = 6, PTYPE_ERROR = 7, - PTYPE_QUEUE = 8, -- use in deprecated mqueue, use skynet.queue instead + PTYPE_QUEUE = 8, -- used in deprecated mqueue, use skynet.queue instead PTYPE_DEBUG = 9, PTYPE_LUA = 10, PTYPE_SNAX = 11, From e6d348e441682cf69d050378119b47e03fa1e430 Mon Sep 17 00:00:00 2001 From: David Feng Date: Wed, 4 Mar 2015 15:30:19 +0800 Subject: [PATCH 3/3] typo fix --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 26bb18c2..d5d471da 100644 --- a/README.md +++ b/README.md @@ -28,9 +28,9 @@ Run these in different console ## About Lua -Skynet now use lua 5.3.0 final, http://www.lua.org/ftp/lua-5.3.0.tar.gz +Skynet now use Lua 5.3.0 final, http://www.lua.org/ftp/lua-5.3.0.tar.gz -You can also use the other offical lua version , edit the makefile by yourself . +You can also use the other official Lua version , edit the makefile by yourself . ## How To (in Chinese)