@section nncp-toss
@verbatim
-% nncp-toss [options] [-dryrun]
+% nncp-toss [options] [-dryrun] [-cycle INT]
@end verbatim
Perform "tossing" operation on all inbound packets. This is the tool
@option{-dryrun} option does not perform any writing and sending, just
tells what it will do.
+@option{-cycle} option tells not to quit, but to repeat tossing every
+@option{INT} seconds in an infinite loop. That can be useful when
+running this command as a daemon.
+
@node nncp-xfer
@section nncp-xfer
"io/ioutil"
"log"
"os"
+ "time"
"cypherpunks.ru/nncp"
)
nodeRaw = flag.String("node", "", "Process only that node")
niceRaw = flag.Int("nice", 255, "Minimal required niceness")
dryRun = flag.Bool("dryrun", false, "Do not actually write any tossed data")
+ cycle = flag.Uint("cycle", 0, "Repeat tossing after N seconds in infinite loop")
quiet = flag.Bool("quiet", false, "Print only errors")
debug = flag.Bool("debug", false, "Print debug messages")
version = flag.Bool("version", false, "Print version information")
}
}
+Cycle:
isBad := false
for nodeId, node := range ctx.Neigh {
if nodeOnly != nil && nodeId != *nodeOnly.Id {
}
isBad = ctx.Toss(node.Id, nice, *dryRun)
}
+ if *cycle > 0 {
+ time.Sleep(time.Duration(*cycle) * time.Second)
+ goto Cycle
+ }
if isBad {
os.Exit(1)
}