Skip to contentSkip to conversation

chunkd: make NID not mandatory

PATCH In review Pete Zaitcev 1 participant 1 message Aug 11, 2009

lore
Share & tools
lore
#0 lore raw

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?

server/cldu.c +5 -0
index 74bbd22..2835b2d 100644
@@ -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
index f577dc6..dc97587 100644
@@ -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);