mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-24 03:53:09 +00:00
gate support TCP_NODELAY
This commit is contained in:
@@ -8,6 +8,7 @@ local watchdog
|
||||
local maxclient
|
||||
local client_number = 0
|
||||
local CMD = setmetatable({}, { __gc = function() netpack.clear(queue) end })
|
||||
local nodelay = false
|
||||
|
||||
local connection = {} -- fd -> connection : { fd , client, agent , ip, mode }
|
||||
local forwarding = {} -- agent -> connection
|
||||
@@ -22,6 +23,13 @@ function CMD.open( source , conf )
|
||||
socketdriver.start(socket)
|
||||
end
|
||||
|
||||
function CMD.nodelay(source, v)
|
||||
if v ~= false then
|
||||
v = true
|
||||
end
|
||||
nodelay = v
|
||||
end
|
||||
|
||||
function CMD.close()
|
||||
assert(socket)
|
||||
socketdriver.close(socket)
|
||||
@@ -106,6 +114,9 @@ function MSG.open(fd, msg)
|
||||
}
|
||||
connection[fd] = c
|
||||
client_number = client_number + 1
|
||||
if nodelay then
|
||||
socketdriver.nodelay(fd)
|
||||
end
|
||||
skynet.send(watchdog, "lua", "socket", "open", fd, msg)
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user