mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +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:
|
||||
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;
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user