diff options
| author | forsyth <forsyth@vitanuova.com> | 2009-08-16 17:39:57 +0100 |
|---|---|---|
| committer | forsyth <forsyth@vitanuova.com> | 2009-08-16 17:39:57 +0100 |
| commit | 979d61f129242c8e47ddb08573147cc30daa8c99 (patch) | |
| tree | a1db5bf57329e851f0d7021afcd998a313dcedf4 /appl/cmd | |
| parent | f064c5817e37b6366e5ed7264663ad94867175ee (diff) | |
20090816-1739
Diffstat (limited to 'appl/cmd')
| -rw-r--r-- | appl/cmd/ndb/registry.b | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/appl/cmd/ndb/registry.b b/appl/cmd/ndb/registry.b index 15e55622..1dd67903 100644 --- a/appl/cmd/ndb/registry.b +++ b/appl/cmd/ndb/registry.b @@ -153,6 +153,7 @@ init(nil: ref Draw->Context, args: list of string) error(sys->sprint("can't open %s: %r", dbfile)); dbload(db); db = nil; # for now assume it's static + attrdb = nil; } navops := chan of ref Navop; spawn navigator(navops); @@ -295,8 +296,9 @@ write(m: ref Tmsg.Write, fid: ref Fid): string return "bad syntax"; # first write names the service (possibly with attributes) if(svc.name == nil){ - if(svcnameok(hd toks) != nil) - return "bad service name"; + err := svcnameok(hd toks); + if(err != nil) + return err; svc.name = hd toks; toks = tl toks; } @@ -306,7 +308,8 @@ write(m: ref Tmsg.Write, fid: ref Fid): string svc.vers++; for(; toks != nil; toks = tl tl toks) svc.set(hd toks, hd tl toks); - Event.post(++rootvers); + rootvers++; + Event.post(rootvers); Qfind => s := string m.data; toks := str->unquoted(s); @@ -339,9 +342,12 @@ clunk(fid: ref Fid) case path & Mask { Qsvc => svc := Service.find(path >> Shift); - if(svc != nil && svc.fid == fid.fid && int svc.get("persist") == 0){ + if(svc != nil && svc.fid == fid.fid && (fid.mode & Sys->ORCLOSE || int svc.get("persist") == 0)){ svc.remove(); - Event.post(rootvers); + if(svc.name != nil){ # otherwise there's no visible change + rootvers++; + Event.post(rootvers); + } } Qevent => if((e := Event.find(fid.fid)) != nil) @@ -359,6 +365,7 @@ remove(fid: ref Fid): string svc := Service.find(path >> Shift); if(fid.uname == svc.owner){ svc.remove(); + rootvers++; Event.post(rootvers); return nil; } @@ -568,7 +575,6 @@ Service.new(owner: string): ref Service services[nservices] = svc; svc.slot = nservices; nservices++; - rootvers++; return svc; } @@ -585,7 +591,6 @@ Service.remove(svc: self ref Service) slot := svc.slot; services[slot] = nil; nservices--; - rootvers++; if(slot != nservices){ services[slot] = services[nservices]; services[slot].slot = slot; |
