diff --git a/changes.md b/changes.md index 515c7bd..b5340d6 100644 --- a/changes.md +++ b/changes.md @@ -28,7 +28,9 @@ Master: - master:peek() - master:pop() -Note: These examples assume that you have already connected the nodes to the node manager. Also you do not need to use the node manager, but sometimes broadcast does not work as expected and the master doesnot connect to the nodes. Using the node manager offers nice features like: removing nodes from the master when they have disconnected, and automatically telling the master when nodes have been added. +**Note On Queues:** When it comes to network queues, they only send 1 way. What I mean by that is that if the master sends a message to a node, its own queue will not get populated at all. The reason for this is because syncing between which popped from what network queue would make things really slow and would not perform so well. This means you have to code a bit differently. Use: master getFreeNode() to get the name of the node under the least amount of load. Then handle the sending of data to each node that way. + +**Note:** These examples assume that you have already connected the nodes to the node manager. Also you do not need to use the node manager, but sometimes broadcast does not work as expected and the master doesnot connect to the nodes. Using the node manager offers nice features like: removing nodes from the master when they have disconnected, and automatically telling the master when nodes have been added. **NodeManager.lua** ```lua diff --git a/multi/integration/networkManager.lua b/multi/integration/networkManager.lua index 35e19a9..b0f2271 100644 --- a/multi/integration/networkManager.lua +++ b/multi/integration/networkManager.lua @@ -130,7 +130,7 @@ function multi:nodeManager(port) end server.timeouts[cid] = true server:send(cid,"ping") - end,3) + end,.1) server.nodes[cid]=data:sub(2,-1) server.OnNodeAdded:Fire(server.nodes[cid]) elseif cmd == "G" then diff --git a/node.lua b/node.lua index 3a247bb..dada4ca 100644 --- a/node.lua +++ b/node.lua @@ -5,7 +5,7 @@ nGLOBAL = require("multi.integration.networkManager").init() node = multi:newNode{ crossTalk = false, -- default value, allows nodes to talk to eachother. WIP NOT READY YET! allowRemoteRegistering = true, -- allows you to register functions from the master on the node, default is false - name = "TESTNODE", -- default value + name = nil, --"TESTNODE", -- default value noBroadCast = true, -- if using the node manager, set this to true to prevent the node from broadcasting managerDetails = {"localhost",12345}, -- connects to the node manager if one exists } diff --git a/test.lua b/test.lua index 2b2cb10..2e2cc36 100644 --- a/test.lua +++ b/test.lua @@ -15,11 +15,14 @@ master.OnNodeConnected(function(node) print("Lets Go!") master:execute("RemoteTest",node,1,2,3) multi:newThread("waiter",function() - print("Hello!") + print("Hello!",node) while true do thread.sleep(2) print("sending") master:pushTo(node,"This is a test 2") + if master.connections["NODE_"..node]==nil then + thread.kill() + end end end) end)