aboutsummaryrefslogtreecommitdiff
path: root/cmd-queue.c
diff options
context:
space:
mode:
authorThomas Adam <thomas@xteddy.org>2015-09-17 00:01:08 +0100
committerThomas Adam <thomas@xteddy.org>2015-09-17 00:01:08 +0100
commita3bce7a3223dcd3e886777190ea64e27a3595a4f (patch)
tree821e3c63abe986591a9865bd9ab4e31b34032fa8 /cmd-queue.c
parent57ad1f6ddf0776a2115b3bf62d58744666b1b283 (diff)
parentc1d0b6a6eed2fd393ea30d257ce147e8f6b5e6c8 (diff)
downloadrtmux-a3bce7a3223dcd3e886777190ea64e27a3595a4f.tar.gz
rtmux-a3bce7a3223dcd3e886777190ea64e27a3595a4f.tar.bz2
rtmux-a3bce7a3223dcd3e886777190ea64e27a3595a4f.zip
Merge branch 'obsd-master'
Diffstat (limited to 'cmd-queue.c')
-rw-r--r--cmd-queue.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/cmd-queue.c b/cmd-queue.c
index af987f59..1fe34dce 100644
--- a/cmd-queue.c
+++ b/cmd-queue.c
@@ -35,7 +35,7 @@ cmdq_new(struct client *c)
cmdq = xcalloc(1, sizeof *cmdq);
cmdq->references = 1;
- cmdq->dead = 0;
+ cmdq->flags = 0;
cmdq->client = c;
cmdq->client_exit = -1;
@@ -51,8 +51,11 @@ cmdq_new(struct client *c)
int
cmdq_free(struct cmd_q *cmdq)
{
- if (--cmdq->references != 0)
- return (cmdq->dead);
+ if (--cmdq->references != 0) {
+ if (cmdq->flags & CMD_Q_DEAD)
+ return (1);
+ return (0);
+ }
cmdq_flush(cmdq);
free(cmdq);
@@ -192,6 +195,7 @@ cmdq_continue_one(struct cmd_q *cmdq)
int
cmdq_continue(struct cmd_q *cmdq)
{
+ struct client *c = cmdq->client;
struct cmd_q_item *next;
enum cmd_retval retval;
int empty;
@@ -199,6 +203,9 @@ cmdq_continue(struct cmd_q *cmdq)
cmdq->references++;
notify_disable();
+ log_debug("continuing cmdq %p: flags=%#x, client=%d", cmdq, cmdq->flags,
+ c != NULL ? c->ibuf.fd : -1);
+
empty = TAILQ_EMPTY(&cmdq->queue);
if (empty)
goto empty;