commit - 70809b211dc08a9445d8b506250eee995c56fd80
commit + eb3092104ea6587ce7d511aeb783866cee1a7844
blob - 30e23aa5ad643b41765d44637b27390d9704dc05
blob + 385a4aa9e9dbe0161a5469f8d84659d3e944c3a0
--- thingsctl/thingsctl.8
+++ thingsctl/thingsctl.8
Disconnect a subscribed client from thingsd by client name.
.It Cm show Ar string
View string version of a thing's packets by its name.
+Showing packets blocks all other calls.
A thing could be sending binary data!
Use at your own risk.
.El
blob - 82966ef15600330361586a06d0defd30ed401bd5
blob + 958e9fd125300e9c913be82cc2ff32645fd16191
--- thingsd/control.c
+++ thingsd/control.c
struct ctl_conn *control_connbyfd(int);
struct ctl_conn *control_connbypid(pid_t);
+int show_ctl, show_fd;
+
void control_close(int);
int
return;
}
+ if (fd == show_fd)
+ show_ctl = 0;
msgbuf_clear(&c->iev.ibuf.w);
TAILQ_REMOVE(&ctl_conns, c, entry);
}
if (n == 0)
break;
+ if (show_ctl) {
+ control_close(fd);
+ return;
+ }
switch (imsg.hdr.type) {
case IMSG_THGS_LOG_VERBOSE:
switch (imsg.hdr.type) {
case IMSG_SHOW_PKTS:
+ show_ctl = 1;
+ show_fd = fd;
main_imsg_compose_thgs(imsg.hdr.type, imsg.hdr.pid,
imsg.data, IMSG_DATA_SIZE(imsg));
break;
blob - de4a9d2507deb0ad5ef5190fda71b4841addd6ee
blob + 5fc346ed91c5ad8bb72a457a03a65f088671e777
--- thingsd/things.c
+++ thingsd/things.c
event_base_loopexit(pthgsd->thgs_eb, &eb_timeout);
event_base_dispatch(pthgsd->thgs_eb);
}
-
thgs_shutdown(pdthgs);
}
switch (imsg.hdr.type) {
case IMSG_SHOW_PKTS:
- if (ctl_pkt->exists)
- return;
TAILQ_FOREACH(thg, &pthgsd->thgs, entry) {
if (strncmp(thg->name, imsg.data,
sizeof(imsg.data)) == 0) {
void
send_ctl_pkt(char *name, char *pkt, int len)
{
- int pchk, snm;
+ int snm;
/* send pkt to control socket */
- pchk = kill(ctl_pkt->cpid, 0);
- if (pchk == -1 && errno > 1) {
- ctl_pkt->exists = false;
- ctl_pkt->cpid = -1;
- ctl_pkt->name = NULL;
- }
if (ctl_pkt->name != NULL)
snm = strcmp(name, ctl_pkt->name);
if (ctl_pkt->exists && snm == 0) {
blob - 4f0f6655d8f9d4d791099928d58d309213c815ea (mode 644)
blob + /dev/null
--- thingsd/thingsctl.8
+++ /dev/null
-.\"
-.\" Copyright (c) 2016 Tracey Emery <tracey@traceyemery.net>
-.\"
-.\" Permission to use, copy, modify, and distribute this software for any
-.\" purpose with or without fee is hereby granted, provided that the above
-.\" copyright notice and this permission notice appear in all copies.
-.\"
-.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
-.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
-.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
-.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
-.\"
-
-.Dd $Mdocdate: January 26 2016 $
-.Dt THINGSCTL 1
-.Os
-.Sh NAME
-.Nm thingsctl
-.Nd thingsd control utility
-.Sh SYNOPSIS
-.Nm thingsctl
-.Op Fl sv
-.Op Fl d Ar host : Ns Ar port
-.Op Fl f Ar device
-.Op Ar command args ...
-.Sh DESCRIPTION
-The
-.Nm
-program is a control utility for the thingsd proxy daemon.
-.Pp