commit f9dd7d4dd64155a00b94a8ef73096f5c2e2d68b8 from: Tracey Emery date: Mon Jun 3 20:27:12 2019 UTC Alert child on control socket disconnect. Redo logging. commit - 5afd96823ab5f51c03ebf35667432f1cc12ca772 commit + f9dd7d4dd64155a00b94a8ef73096f5c2e2d68b8 blob - 385a4aa9e9dbe0161a5469f8d84659d3e944c3a0 blob + a61c6268de48d7570eaed8b9ecbb79082c02a396 --- thingsctl/thingsctl.8 +++ thingsctl/thingsctl.8 @@ -51,6 +51,12 @@ Show a summary of all sockets being used by the things .It Cm list things Show all things. This will not list non-persistent things. +.It Cm log brief +Disable verbose logging. +.It Cm log verbose +Enable verbose logging. +.It Cm log debug +Enable very noisy debug logging. .It Cm kill Ar string Disconnect a subscribed client from thingsd by client name. .It Cm show Ar string blob - 958e9fd125300e9c913be82cc2ff32645fd16191 blob + e1d5350bcd093615d794447b08ac3d97f184e169 --- thingsd/control.c +++ thingsd/control.c @@ -176,6 +176,8 @@ control_close(int fd) { struct ctl_conn *c; + main_imsg_compose_thgs(IMSG_CTL_END, 0, NULL, 0); + if ((c = control_connbyfd(fd)) == NULL) { log_warnx("%s: fd %d: not found", __func__, fd); return; blob - 62e7e08cad54bbaa4818926d27d30f97b0fca025 blob + c275d08591e6cef647966d452b9a488d2731f579 --- thingsd/log.c +++ thingsd/log.c @@ -147,9 +147,9 @@ log_debug(const char *emsg, ...) { va_list ap; - if (verbose) { + if (verbose > 1) { va_start(ap, emsg); - vlog(LOG_DEBUG, emsg, ap); + vlog(LOG_INFO, emsg, ap); va_end(ap); } } blob - /dev/null blob + 6f2460d748d5a624a90e35b08ce19522b8ffac91 (mode 644) --- /dev/null +++ thingsd/exists @@ -0,0 +1,11 @@ +./things.c: ctl_pkt->exists = false; +./things.c: ctl_pkt->pid = getppid(); +./things.c: ctl_pkt->cpid = -1; +./things.c: if ((ctl_pkt->name = +./things.c: ctl_pkt->exists = true; +./things.c: ctl_pkt->cpid = imsg.hdr.pid; +./things.c: ctl_pkt->pid, NULL, 0); +./things.c: if (ctl_pkt->exists) { +./things.c: if (ctl_pkt->name != NULL) +./things.c: snm = strcmp(name, ctl_pkt->name); +./things.c: thgs_imsg_compose_main(IMSG_SHOW_PKTS, ctl_pkt->pid, blob - 02f861e92acbad1f2bc0208fec8439333c79faa4 blob + 6b6642494e8b7ed4230bd63a7c0b6810b9123037 --- thingsd/things.c +++ thingsd/things.c @@ -199,6 +199,10 @@ thgs_dispatch_main(int fd, short event, void *bula) memcpy(&verbose, imsg.data, sizeof(verbose)); log_setverbose(verbose); break; + case IMSG_CTL_END: + ctl_pkt->exists = false; + ctl_pkt->cpid = -1; + break; default: log_debug("%s: error handling imsg %d", __func__, imsg.hdr.type); @@ -484,10 +488,10 @@ send_ctl_pkt(char *name, char *pkt, int len) int snm = -1; /* send pkt to control socket */ - if (ctl_pkt->name != NULL) - snm = strcmp(name, ctl_pkt->name); - if (ctl_pkt->exists && snm == 0) { - thgs_imsg_compose_main(IMSG_SHOW_PKTS, ctl_pkt->pid, - pkt, len); + if (ctl_pkt->exists) { + if (ctl_pkt->name != NULL) + if ((snm = strcmp(name, ctl_pkt->name)) == 0) + thgs_imsg_compose_main(IMSG_SHOW_PKTS, + ctl_pkt->pid, pkt, len); } }