chunkd: make NID not mandatory
PATCH 2/4 chunkd: make NID not mandatory
It's useful to quit with an error message if a user plainly forgets to configure NID, but on the other hand someone might want to test something or such. Maybe add a --standalone option for that?
Signed-off-by Pete Zaitcev <[email protected]>
server/cldu.c +5 -0
@@ -507,6 +507,8 @@ int cld_begin(const char *thishost, const char *thiscell, uint32_t nid, cld_ops.printf = log; +if (!nid) +return 0 ;cldc_init ();/*
@@ -574,6 +576,9 @@ void cld_end(void) {int i; +if (!ses.nid) +return ; +if (ses.lib) {event_del (&ses.ev);// if (ses.sess_open) /* kill it always, include half-open */
server/config.c +7 -0
@@ -449,10 +449,17 @@ void read_config(void) }if (chunkd_srv.nid ==0 ) {/* We have no NID, it's fatal */ +#if 0 /* Not having NID is made non-fatal, because of CLD-less applications */ if (!ctx.badnid) {/* NID is missing (not invalid) */ applog (LOG_ERR ,"No NID configured" ); }exit (1 ); +#else +if (ctx.badnid) +exit (1 ); +if (debugging) +applog (LOG_DEBUG ,"No NID configured" ); +#endif }free (ctx.geo_area);