gate support TCP_NODELAY

This commit is contained in:
Cloud Wu
2014-07-09 12:03:44 +08:00
parent fe5c73b1e8
commit d05859b766
8 changed files with 71 additions and 14 deletions

View File

@@ -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