This is a read-only snapshot of the ComputerCraft forums, taken in April 2020.
Elsys656's profile picture

ComputerCraft-LyqydNet issues

Started by Elsys656, 22 March 2015 - 09:25 AM
Elsys656 #1
Posted 22 March 2015 - 10:25 AM
I have set up a network with this api now the netmon sees HA packets on startup of the various computers however I cannot connect to a server not even the test server… which I have copied exactly in addition to writing my own both hang when trying to connect… So I looked in etc for route files and none are there…

By the way I used both the computer's label and its ID in the connect function neither of which work I do have a vanilla cc gps array already set up and functioning do I need to use a lyqydnet array? I know my gps array functions because I use it to determine the position of 2 redstone in motion elevators so far.

os.loadAPI('usr/apis/sync')
local m = peripheral.wrap('top')
m.setTextScale(0.5)
sync.addTarget(m)
sync.redirect(true)
shell.run("lyqydnet")
shell.run("lyqydnet route")
shell.run("rom/programs/shell")

my startup on the router

os.loadAPI('usr/apis/sync')
local m = peripheral.wrap('top')
m.setTextScale(0.5)
sync.addTarget(m)
sync.redirect(true)
shell.run("lyqydnet")
shell.run("rom/programs/shell")

my startup on the various servers

my server is a rednet relay with TLS implemented via an interface with a Cryptographic Accelerator. My server/client send 4 packets before simply relaying them. I also tried the example server/client in the readme and it doesn't connect either.

My Computer Craft version is 1.58
Edited on 22 March 2015 - 09:31 AM
Lyqyd #2
Posted 23 March 2015 - 01:33 AM
Well, try changing the router's startup to only run the lyqydnet program once, with the route argument, rather than twice. You also shouldn't need the last line on either, as the shell should be perfectly usable after the startup exits. I'll have to do some digging on it to see what's going on.
Elsys656 #3
Posted 23 March 2015 - 02:12 AM
about 20 minutes ago I adjusted the startup file to remove everything but


shell.run("lyqydnet")

on the servers and


shell.run("lyqydnet route")

on the router

I also changed the log function on the router to the following so I could see where in propagation the router was hanging up


local function log(level, message)
os.queueEvent("service_message", level, LyqydOS and process.id() or "lyqydnet", message)
local file = io.open('/etc/log',fs.exists('/etc/log') and 'a' or 'w')
if file then
  file:write(level..","..message..'\n')
  file:close()
end
end

this revealed the following in my log file it just repeats this on successive reboots first router then servers also tried rebooting the router last neither order seems to work.

info,routing enabled
info,reading hosts
info,read 0 hosts
info,lyqydnet SI packet received from 18
info,announcing

This means its dying in the router loop on line 396 IE it's not handling the HA packets sent by the clients which I can see when I run

netmon 443 444 on the router the 443 and 444 range are the ports used by testserver/testclient changed them to correspond with my server/client

my netmon output is with a slight netmon modification analogous to what I did to Lyqydnet's log function as follows


while true do
local event = {os.pullEvent()}
if event[1] == "modem_message" then
  print(event[4].."->"..event[3]..": "..(type(event[5]) == "table" and textutils.serialize(event[5]) or tostring(event[5])))
  local file = io.open('/etc/netmonlog',fs.exists('/etc/netmonlog') and 'a' or 'w')
   if file then
    file:write(event[4].."->"..event[3]..": "..(type(event[5]) == "table" and textutils.serialize(event[5]) or tostring(event[5]))..'\n')
    file:close()
   end
end
end

The output of such


19->65535: {["fromSock"]=4,["lyqydnet"]=true,["origin"]=19,["type"]="HA",["confirm"]=false,["payload"]={["type"]="C",["label"]="ftp.ocean.elsys",},["toSock"]=4,["distance"]=0,["destination"]=65535,}
23->65535: {["fromSock"]=4,["lyqydnet"]=true,["origin"]=23,["type"]="HA",["confirm"]=false,["payload"]={["type"]="C",["label"]="auth.ocean.elsys",},["toSock"]=4,["distance"]=0,["destination"]=65535,}
20->65535: {["fromSock"]=4,["lyqydnet"]=true,["origin"]=20,["type"]="HA",["confirm"]=false,["payload"]={["type"]="C",["label"]="db.ocean.elsys",},["toSock"]=4,["distance"]=0,["destination"]=65535,}
21->65535: {["fromSock"]=4,["lyqydnet"]=true,["origin"]=21,["type"]="HA",["confirm"]=false,["payload"]={["type"]="C",["label"]="wall.ocean.elsys",},["toSock"]=4,["distance"]=0,["destination"]=65535,}

further inspection of the overrides of the default rednet methods require a program argument

explicitly set this to false at the top of lyqydnet unless it gets overriden further down which it would with your os installed.

inserted log methods in each of the override functions

resulting in the hooks being put into place which they weren't before however processModemMessage never fires therefore no lyqydnet_packet for the daemon to catch ie saveRoute never gets called. Tried to remedy this but my understanding of the underlying events is lacking so I removed my log calls. Also changed the label of dns.ocean.elsys to router.ocean.elsys just to be sure the dns keyword wasn't screwing things up.
Edited on 23 March 2015 - 02:48 AM
Lyqyd #4
Posted 23 March 2015 - 03:00 AM
I'm having trouble reproducing the issue on my end. Here's what I did setting them up, maybe you can describe your setup as well so we can see what's different:

I placed three new computers down in close proximity and connected them via wired network (wireless is perfectly fine too, as long as they are in range).
I labelled all three computers.
I used packman to install LyqydNet (any method of getting the files onto the computer is fine, of course).
I set two of the computers as normal hosts by adding this to their startup files: shell.run("lyqydnet")
I set the third as a router by adding this to its startup file: shell.run("lyqydnet route")
I rebooted all three computers.
I ran service console on the router computer (using the service program), so I could view the diagnostic messages.
I rebooted one of the other computers and observed that the router computer:
- Received the HA packet from the other computer.
- Saved its host file
- Sent the HT packet back to the rebooted computer.

With a fresh install working here, I'm kind of stumped as to what's going on with your setup, especially since your router computer isn't seeming to get the packets correctly. If you're willing to try it, setting up a clean set of computers for testing may help narrow down possibilities (or it may not). If a clean set of computers doesn't work, I may have to ask for the files from the computers involved to see if I can figure out what's going on.

As to the specific point where the code is failing, it isn't line 396–the logging should have also mentioned the receipt of the HA packet, and the saving of the hosts file, which it did not. Somewhere between announcing (which succeeds) and receiving any lyqydnet packets, something is falling apart. Unfortunately, it seems to be failing on your setup and not on a fresh setup I created from the code on the github repo, which makes it tricky to track down!

Sorry you're having trouble with it, though. Hopefully we can get it working for you!
Elsys656 #5
Posted 23 March 2015 - 04:50 AM
Im guessing the only difference is your running LyqydOS while I'm not I installed packman and had that application install LyqydNet only which runs but same overall result… im going to try relabeling the machines to single word names if that works then fine if not I don't mind using LyqydOS and I'll install that as well. I hope it doesn't conflict with my existing apps which are bedrock apps I guess ill find out. I like how the folder structure is that of a nix distro though that's cool

Edit: it wasn't the labeling going for an install of your OS as well ill report back with the results
Edited on 23 March 2015 - 03:56 AM
Lyqyd #6
Posted 23 March 2015 - 04:58 AM
Well, those three computers didn't actually have LyqydOS installed, I had just copied over the service program by itself so I could have it display the diagnostic information. Sorry about the confusion there! Everything should work fine without LyqydOS installed.

However, if you do install LyqydOS, you'll want to take the shell.run("lyqydnet") out of the startup file, and add a new line with just lyqydnet in the /LyqydOS/.init file.
Elsys656 #7
Posted 23 March 2015 - 06:19 AM
My computercraft install doesn't seem to be compatible as it uses some 1.6 methods well LyqydOS anyway installed the service program as well as trying with new computers named test1 and test2 still doesn't write hosts to etc

and service doesn't print anything

Tried with a band new save same result

Edit: Upgrading to CC 1.63 from 1.58 solved the issue also I was actually able to upgrade all my other cc related mods and nothing broke except the sync api which ill need to replace in some fashion. I had tried this previously and couldn't get it to work so I was doubtful it would but it did so yea problem solved. CC 1.58 is apparently incompatible with your API that's unfortunate if it's something you care to support but otherwise everything is good now.
Edited on 23 March 2015 - 08:56 AM