Compare commits

..

3 Commits

Author SHA1 Message Date
Cloud Wu
4673344e1e update readme, add wiki link 2014-08-02 22:02:17 +08:00
Cloud Wu
b49fc291a7 bugfix: delete local channel 2014-08-02 18:32:54 +08:00
Cloud Wu
11c528987c bugfix: socket.read(fd, nil) should clear buffer size to 0 2014-07-31 17:22:59 +08:00
4 changed files with 13 additions and 7 deletions

View File

@@ -34,8 +34,6 @@ Each lua file only load once and cache it in memory during skynet start . so if
You can also use the offical lua version , edit the makefile by yourself .
## Blog (in Chinese)
## How To (in Chinese)
* http://blog.codingnow.com/2012/09/the_design_of_skynet.html
* http://blog.codingnow.com/2012/08/skynet.html
* http://blog.codingnow.com/eo/skynet/
* Read Wiki https://github.com/cloudwu/skynet/wiki

View File

@@ -246,6 +246,7 @@ lclearbuffer(lua_State *L) {
while(sb->head) {
return_free_node(L,2,sb);
}
sb->size = 0;
return 0;
}
@@ -264,6 +265,7 @@ lreadall(lua_State *L) {
return_free_node(L,2,sb);
}
luaL_pushresult(&b);
sb->size = 0;
return 1;
}

View File

@@ -50,8 +50,10 @@ function command.DEL(source, c)
channel[c] = nil
channel_n[c] = nil
channel_remote[c] = nil
for node in pairs(remote) do
skynet.send(node_address[node], "lua", "DELR", c)
if remote then
for node in pairs(remote) do
skynet.send(node_address[node], "lua", "DELR", c)
end
end
return NORET
end

View File

@@ -4,9 +4,13 @@ local mc = require "multicast"
skynet.start(function()
print("remote start")
skynet.monitor("simplemonitor", true)
local console = skynet.newservice("console")
local channel = dc.get "MCCHANNEL"
if channel then
print("remote channel", channel)
else
print("create local channel")
end
for i=1,10 do
local sub = skynet.newservice("testmulticast", "sub")
skynet.call(sub, "lua", "init", channel)