mirror of
https://github.com/cloudwu/skynet.git
synced 2026-07-25 12:43:09 +00:00
fix issue #741
This commit is contained in:
@@ -138,19 +138,27 @@ function command.socket(source, subcmd, fd, msg)
|
|||||||
local sz
|
local sz
|
||||||
local addr, session, msg, padding, is_push = cluster.unpackrequest(msg)
|
local addr, session, msg, padding, is_push = cluster.unpackrequest(msg)
|
||||||
if padding then
|
if padding then
|
||||||
local req = large_request[session] or { addr = addr , is_push = is_push }
|
local requests = large_request[fd]
|
||||||
large_request[session] = req
|
if requests == nil then
|
||||||
|
requests = {}
|
||||||
|
large_request[fd] = requests
|
||||||
|
end
|
||||||
|
local req = requests[session] or { addr = addr , is_push = is_push }
|
||||||
|
requests[session] = req
|
||||||
table.insert(req, msg)
|
table.insert(req, msg)
|
||||||
return
|
return
|
||||||
else
|
else
|
||||||
local req = large_request[session]
|
local requests = large_request[fd]
|
||||||
|
if requests then
|
||||||
|
local req = requests[session]
|
||||||
if req then
|
if req then
|
||||||
large_request[session] = nil
|
requests[session] = nil
|
||||||
table.insert(req, msg)
|
table.insert(req, msg)
|
||||||
msg,sz = cluster.concat(req)
|
msg,sz = cluster.concat(req)
|
||||||
addr = req.addr
|
addr = req.addr
|
||||||
is_push = req.is_push
|
is_push = req.is_push
|
||||||
end
|
end
|
||||||
|
end
|
||||||
if not msg then
|
if not msg then
|
||||||
local response = cluster.packresponse(session, false, "Invalid large req")
|
local response = cluster.packresponse(session, false, "Invalid large req")
|
||||||
socket.write(fd, response)
|
socket.write(fd, response)
|
||||||
@@ -191,8 +199,8 @@ function command.socket(source, subcmd, fd, msg)
|
|||||||
skynet.error(string.format("socket accept from %s", msg))
|
skynet.error(string.format("socket accept from %s", msg))
|
||||||
skynet.call(source, "lua", "accept", fd)
|
skynet.call(source, "lua", "accept", fd)
|
||||||
else
|
else
|
||||||
large_request = {}
|
large_request[fd] = nil
|
||||||
skynet.error(string.format("socket %s %d : %s", subcmd, fd, msg))
|
skynet.error(string.format("socket %s %d %s", subcmd, fd, msg or ""))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user