mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
add assert
This commit is contained in:
@@ -198,6 +198,9 @@ _sendname(lua_State *L, struct skynet_context * context, const char * dest) {
|
|||||||
default:
|
default:
|
||||||
luaL_error(L, "skynet.send invalid param %s", lua_type(L,4));
|
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);
|
lua_pushinteger(L,session);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
@@ -266,6 +269,9 @@ _send(lua_State *L) {
|
|||||||
default:
|
default:
|
||||||
luaL_error(L, "skynet.send invalid param %s", lua_type(L,4));
|
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);
|
lua_pushinteger(L,session);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ trace_register(struct trace_pool *p, int session) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
int hash = session % HASH_SIZE;
|
int hash = session % HASH_SIZE;
|
||||||
assert(t->session == 0 && session !=0);
|
assert(t->session == 0 && session > 0);
|
||||||
t->session = session;
|
t->session = session;
|
||||||
t->prev = NULL;
|
t->prev = NULL;
|
||||||
t->next = p->slot[hash];
|
t->next = p->slot[hash];
|
||||||
@@ -114,7 +114,7 @@ trace_yield(struct trace_pool *p) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
trace_switch(struct trace_pool *p, int session) {
|
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 *t = p->slot[session % HASH_SIZE];
|
||||||
struct trace_info *prev = NULL;
|
struct trace_info *prev = NULL;
|
||||||
while (t) {
|
while (t) {
|
||||||
|
|||||||
Reference in New Issue
Block a user