bugfix: free message when cluster not connected

This commit is contained in:
Cloud Wu
2015-07-22 15:52:26 +08:00
parent 3131bca6ef
commit 4ebb139c2b
2 changed files with 5 additions and 5 deletions

View File

@@ -74,8 +74,9 @@ lpackrequest(lua_State *L) {
return luaL_error(L, "Invalid request message");
}
size_t sz = (size_t)luaL_checkinteger(L,4);
int session = luaL_checkinteger(L,2);
int session = luaL_optinteger(L,2,1); // new connection start with 1
if (session <= 0) {
skynet_free(msg);
return luaL_error(L, "Invalid request session %d", session);
}
int addr_type = lua_type(L,1);