httpd don't need readline now

This commit is contained in:
Cloud Wu
2014-07-23 12:19:48 +08:00
parent 551d5048c4
commit 18f20425a0
6 changed files with 176 additions and 93 deletions

View File

@@ -7,9 +7,9 @@ local function echo(id)
socket.start(id)
while true do
local str = socket.readline(id,"\n")
local str = socket.read(id)
if str then
socket.write(id, str .. "\n")
socket.write(id, str)
else
socket.close(id)
return
@@ -21,9 +21,6 @@ if mode == "agent" then
id = tonumber(id)
skynet.start(function()
-- A small limit, if socket buffer overflow, close the client
socket.limit(64)
skynet.fork(function()
echo(id)
skynet.exit()