mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 20:23:06 +00:00
fix issue #59
This commit is contained in:
@@ -34,9 +34,14 @@ local function message_dispatch(f)
|
|||||||
local msg = table.remove(message_queue,1)
|
local msg = table.remove(message_queue,1)
|
||||||
local session = msg.session
|
local session = msg.session
|
||||||
if session == 0 then
|
if session == 0 then
|
||||||
if do_func(f, msg) ~= nil then
|
local ok, msg = do_func(f, msg)
|
||||||
skynet.fork(message_dispatch,f)
|
if ok then
|
||||||
error(string.format("[:%x] send a message to [:%x] return something", msg.addr, skynet.self()))
|
if msg then
|
||||||
|
skynet.fork(message_dispatch,f)
|
||||||
|
error(string.format("[:%x] send a message to [:%x] return something", msg.addr, skynet.self()))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
error(string.format("[:%x] send a message to [:%x] throw an error : %s", msg.addr, skynet.self(),msg))
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
local data, size = skynet.pack(do_func(f,msg))
|
local data, size = skynet.pack(do_func(f,msg))
|
||||||
|
|||||||
@@ -14,7 +14,8 @@
|
|||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#define PREALLOCMEM (1024 * 1024)
|
// define PREALLOCMEM to enable skynet defined alloc
|
||||||
|
//#define PREALLOCMEM (1024 * 1024)
|
||||||
|
|
||||||
// time
|
// time
|
||||||
|
|
||||||
@@ -259,8 +260,8 @@ snlua_create(void) {
|
|||||||
|
|
||||||
void
|
void
|
||||||
snlua_release(struct snlua *l) {
|
snlua_release(struct snlua *l) {
|
||||||
void * ud = NULL;
|
|
||||||
#ifdef PREALLOCMEM
|
#ifdef PREALLOCMEM
|
||||||
|
void * ud = NULL;
|
||||||
lua_Alloc lalloc = lua_getallocf(l->L, &ud);
|
lua_Alloc lalloc = lua_getallocf(l->L, &ud);
|
||||||
assert(lalloc == skynet_lua_alloc);
|
assert(lalloc == skynet_lua_alloc);
|
||||||
lua_close(l->L);
|
lua_close(l->L);
|
||||||
|
|||||||
Reference in New Issue
Block a user