mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-22 02:53:09 +00:00
skynet.forward
This commit is contained in:
@@ -229,6 +229,15 @@ _redirect(lua_State *L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_forward(lua_State *L) {
|
||||
struct skynet_context * context = lua_touserdata(L, lua_upvalueindex(1));
|
||||
uint32_t dest = luaL_checkunsigned(L,1);
|
||||
skynet_forward(context, dest);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
_error(lua_State *L) {
|
||||
struct skynet_context * context = lua_touserdata(L, lua_upvalueindex(1));
|
||||
@@ -276,6 +285,7 @@ luaopen_skynet_c(lua_State *L) {
|
||||
{ "send" , _send },
|
||||
{ "genid", _genid },
|
||||
{ "redirect", _redirect },
|
||||
{ "forward", _forward },
|
||||
{ "command" , _command },
|
||||
{ "callback" , _callback },
|
||||
{ "error", _error },
|
||||
|
||||
@@ -159,6 +159,7 @@ function skynet.send(addr, typename, ...)
|
||||
end
|
||||
|
||||
skynet.genid = assert(c.genid)
|
||||
skynet.forward = assert(c.forward)
|
||||
|
||||
skynet.redirect = function(dest,source,typename,...)
|
||||
return c.redirect(dest, source, proto[typename].id, ...)
|
||||
|
||||
Reference in New Issue
Block a user