From 46066205834b852bc50700f1ef504f8fc5f630a1 Mon Sep 17 00:00:00 2001 From: XeonSquared Date: Wed, 18 Mar 2020 14:06:40 +1100 Subject: [PATCH] write documentation for netutil --- lib/netutil.lua | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/lib/netutil.lua b/lib/netutil.lua index 1d569a1..5f1585f 100644 --- a/lib/netutil.lua +++ b/lib/netutil.lua @@ -4,16 +4,15 @@ local event = require "event" local rpc = require "rpc" local netutil = {} -function netutil.importfs(host,rpath,lpath) +function netutil.importfs(host,rpath,lpath) -- import filesystem *rpath* from *host* and attach it to *lpath* local px = rpc.proxy(host,rpath.."_") function px.getLabel() return host..":"..rpath end - fs.mount(lpath,px) - return true + return fs.mount(lpath,px) end -function netutil.exportfs(path) +function netutil.exportfs(path) -- export the directory *path* over RPC local path = "/"..table.concat(fs.segments(path),"/") local px = ufs.create(path) for k,v in pairs(px) do @@ -23,7 +22,7 @@ function netutil.exportfs(path) return true end -function netutil.ping(addr,times,timeout, silent) +function netutil.ping(addr,times,timeout, silent) -- Request acknowledgment from *addr*, waiting *timeout* seconds each try, and try *times* times. If *silent* is true, don't print status. Returns true if there was at least one successful ping, the number of successes, the number of failures, and the average round trip time. local times, timeout = times or 5, timeout or 30 local success, fail, time, avg = 0, 0, 0, 0 for i = 1, times do