mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-23 19:43:09 +00:00
remove netpack from gate service
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
local skynet = require "skynet"
|
||||
local gateserver = require "snax.gateserver"
|
||||
local netpack = require "skynet.netpack"
|
||||
|
||||
local watchdog
|
||||
local connection = {} -- fd -> connection : { fd , client, agent , ip, mode }
|
||||
@@ -22,9 +21,12 @@ function handler.message(fd, msg, sz)
|
||||
local c = connection[fd]
|
||||
local agent = c.agent
|
||||
if agent then
|
||||
-- It's safe to redirect msg directly , gateserver framework will not free msg.
|
||||
skynet.redirect(agent, c.client, "client", fd, msg, sz)
|
||||
else
|
||||
skynet.send(watchdog, "lua", "socket", "data", fd, netpack.tostring(msg, sz))
|
||||
skynet.send(watchdog, "lua", "socket", "data", fd, skynet.tostring(msg, sz))
|
||||
-- skynet.tostring will copy msg to a string, so we must free msg here.
|
||||
skynet.trash(msg,sz)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user