summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lib/command_queue.c18
-rw-r--r--lib/vty.c3
-rw-r--r--lib/vty_cli.c3
-rw-r--r--lib/vty_io.c3
4 files changed, 21 insertions, 6 deletions
diff --git a/lib/command_queue.c b/lib/command_queue.c
index 18144844..5f14abae 100644
--- a/lib/command_queue.c
+++ b/lib/command_queue.c
@@ -54,8 +54,11 @@ void
cq_enqueue(struct vty *vty, qpn_nexus dst)
{
struct cq_command_args* args ;
+ mqueue_block mqb ;
- mqueue_block mqb = mqb_init_new(NULL, cq_action, vty) ;
+ assert(vty_cli_nexus) ; /* must be running qnexus-wise */
+
+ mqb = mqb_init_new(NULL, cq_action, vty) ;
args = mqb_get_args(mqb) ;
args->ret = CMD_QUEUED ;
@@ -77,6 +80,8 @@ cq_action(mqueue_block mqb, mqb_flag_t flag)
struct vty *vty;
struct cq_command_args* args ;
+ assert(vty_cli_nexus) ; /* must be running qnexus-wise */
+
vty = mqb_get_arg0(mqb);
args = mqb_get_args(mqb) ;
@@ -113,6 +118,8 @@ cq_return(mqueue_block mqb, mqb_flag_t flag)
struct vty *vty ;
struct cq_command_args* args ;
+ assert(vty_cli_nexus) ; /* must be running qnexus-wise */
+
vty = mqb_get_arg0(mqb) ;
args = mqb_get_args(mqb) ;
@@ -127,7 +134,7 @@ cq_return(mqueue_block mqb, mqb_flag_t flag)
}
/*------------------------------------------------------------------------------
- * Revoke any messages related to the given VTY
+ * Revoke any messages related to the given VTY -- if running qnexus-wise.
*
* Revokes in vty_cmd_nexus -- so before command is started
* and in vty_cli_nexus -- so after command has completed
@@ -138,7 +145,10 @@ cq_return(mqueue_block mqb, mqb_flag_t flag)
void
cq_revoke(struct vty *vty)
{
- mqueue_revoke(vty_cmd_nexus->queue, vty) ;
- mqueue_revoke(vty_cli_nexus->queue, vty) ;
+ if (vty_cli_nexus)
+ {
+ mqueue_revoke(vty_cmd_nexus->queue, vty) ;
+ mqueue_revoke(vty_cli_nexus->queue, vty) ;
+ } ;
}
diff --git a/lib/vty.c b/lib/vty.c
index 51bf4a5a..9b1e5d87 100644
--- a/lib/vty.c
+++ b/lib/vty.c
@@ -440,7 +440,8 @@ uty_reset (bool curtains, const char* why)
vio = next ;
next = sdl_next(vio, vio_list) ;
- cq_revoke(vio->vty) ;
+ if (vio->type == VTY_TERM)
+ cq_revoke(vio->vty) ;
if (why != NULL)
vio->close_reason = why ;
diff --git a/lib/vty_cli.c b/lib/vty_cli.c
index fab266b1..b4791365 100644
--- a/lib/vty_cli.c
+++ b/lib/vty_cli.c
@@ -349,6 +349,9 @@ uty_cli_start(vty_io vio)
extern void
uty_cli_close(vty_io vio)
{
+ VTY_ASSERT_LOCKED() ;
+ assert(vio->type == VTY_TERM) ;
+
cq_revoke(vio->vty) ;
vio->cli_blocked = 1 ; /* don't attempt any more */
diff --git a/lib/vty_io.c b/lib/vty_io.c
index 9fd9ff2a..2eadc2d1 100644
--- a/lib/vty_io.c
+++ b/lib/vty_io.c
@@ -775,7 +775,8 @@ uty_close (vty_io vio)
{
uty_half_close(vio, NULL) ; /* place on death watch -- if not
already done */
- uty_cli_close(vio) ; /* tell the CLI to stop */
+ if (vio->type == VTY_TERM)
+ uty_cli_close(vio) ; /* tell the CLI to stop */
vio->closed = 1 ; /* now closed (stop uty_write()
from recursing) */