After connecting, socket can send before connected. remove block connect api

This commit is contained in:
Cloud Wu
2014-06-20 02:49:48 +08:00
parent 1a44bfb09a
commit c3eb5cd202
10 changed files with 48 additions and 48 deletions

View File

@@ -1,5 +1,21 @@
local skynet = require "skynet"
skynet.register_protocol {
name = "text",
id = skynet.PTYPE_TEXT,
pack = function (...)
local n = select ("#" , ...)
if n == 0 then
return ""
elseif n == 1 then
return tostring(...)
else
return table.concat({...}," ")
end
end,
unpack = skynet.tostring
}
skynet.start(function()
skynet.dispatch("text", function(session, address, text)
print("[GLOBALLOG]", skynet.address(address),text)