do not allow ndb files to go stale. make sure they are reopened Reference: /n/atom/patch/applied2013/ndbdbreopen Date: Thu Jun 20 00:28:20 CES 2013 Signed-off-by: quanstro@quanstro.net --- /sys/src/cmd/ndb/dblookup.c Thu Jun 20 00:27:33 2013 +++ /sys/src/cmd/ndb/dblookup.c Thu Jun 20 00:27:33 2013 @@ -63,13 +63,17 @@ } int -opendatabase(void) +opendatabase0(int reopen) { char netdbnm[256]; Ndb *xdb, *netdb; - - if (db) - return 0; + + if(db){ + if(!reopen) + return 0; + db = ndbreopendb(db); + return db? 0: -1; + } xdb = ndbopen(dbfile); /* /lib/ndb */ @@ -82,6 +86,12 @@ return db? 0: -1; } +int +opendatabase(void) +{ + return opendatabase0(0); +} + /* * lookup an RR in the network database, look for matches * against both the domain name and the wildcarded domain name. @@ -706,7 +716,7 @@ lock(&dblock); - if(opendatabase() < 0){ + if(opendatabase0(1) < 0){ unlock(&dblock); return; } @@ -736,7 +746,7 @@ freearea(&owned); freearea(&delegated); - /* reopen all the files (to get oldest for time stamp) */ + /* reopen all the files (to get oldest for time stamp) necessary with opendatabase0? */ for(ndb = db; ndb; ndb = ndb->next) ndbreopen(ndb);