Commit 25ba5b0f authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 6454fbcf
......@@ -2110,17 +2110,30 @@ func main() {
//log.CopyStandardLogTo("WARNING") // XXX -> "DEBUG" if -d ?
defer log.Flush()
err := _main()
if err != nil {
log.Fatal(err)
}
}
func _main() (err error) {
debug := flag.Bool("d", false, "debug")
autoexit := flag.Bool("autoexit", false, "automatically stop service when there is no client activity")
// XXX option to prevent starting if wcfs was already started ?
// XXX option to prevent starting if wcfs was already started/mounted on mntpt ?
// XXX do the check unconditionally?
flag.Parse()
if len(flag.Args()) != 2 {
log.Fatalf("Usage: %s [OPTIONS] zurl mntpt", os.Args[0])
fmt.Errorf("Usage: %s [OPTIONS] zurl mntpt", os.Args[0])
}
zurl := flag.Args()[0]
mntpt := flag.Args()[1]
defer xerr.Contextf(&err, "fsserve %s <- %s", mntpt, zurl) // XXX text
xclose := func(c io.Closer) {
err = xerr.First(err, c.Close())
}
// debug -> precise t, no dates (XXX -> always precise t?)
if *debug {
stdlog.SetFlags(stdlog.Lmicroseconds)
......@@ -2132,16 +2145,16 @@ func main() {
ReadOnly: true,
})
if err != nil {
log.Fatal(err)
return err
}
defer zstor.Close()
defer xclose(zstor)
zwatchq := make(chan zodb.Event)
at0 := zstor.AddWatch(zwatchq)
defer zstor.DelWatch(zwatchq)
zdb := zodb.NewDB(zstor)
defer zdb.Close() // XXX err
defer xclose(zdb)
zhead, err := zopen(ctx, zdb, &zodb.ConnOptions{
At: at0,
......@@ -2278,4 +2291,6 @@ func main() {
log.Fatal(err) // XXX err ctx?
}
<-done
return nil
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment