diff --git a/lualib-src/lua-skynet.c b/lualib-src/lua-skynet.c index 4999b5db..138234d4 100644 --- a/lualib-src/lua-skynet.c +++ b/lualib-src/lua-skynet.c @@ -198,6 +198,9 @@ _sendname(lua_State *L, struct skynet_context * context, const char * dest) { default: luaL_error(L, "skynet.send invalid param %s", lua_type(L,4)); } + if (session < 0) { + luaL_error(L, "skynet.send session (%d) < 0", session); + } lua_pushinteger(L,session); return 1; } @@ -266,6 +269,9 @@ _send(lua_State *L) { default: luaL_error(L, "skynet.send invalid param %s", lua_type(L,4)); } + if (session < 0) { + luaL_error(L, "skynet.send session (%d) < 0", session); + } lua_pushinteger(L,session); return 1; } diff --git a/lualib-src/trace_service.c b/lualib-src/trace_service.c index acd8401f..7c3c8653 100644 --- a/lualib-src/trace_service.c +++ b/lualib-src/trace_service.c @@ -87,7 +87,7 @@ trace_register(struct trace_pool *p, int session) { return; } int hash = session % HASH_SIZE; - assert(t->session == 0 && session !=0); + assert(t->session == 0 && session > 0); t->session = session; t->prev = NULL; t->next = p->slot[hash]; @@ -114,7 +114,7 @@ trace_yield(struct trace_pool *p) { void trace_switch(struct trace_pool *p, int session) { - assert(p->current == NULL); + assert(p->current == NULL && session > 0); struct trace_info *t = p->slot[session % HASH_SIZE]; struct trace_info *prev = NULL; while (t) {