From ed7f3be2586dcc5e9fb01b9d0d6f9883ce013c63 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Wed, 17 Apr 2013 06:14:42 -0700 Subject: [PATCH] Added a tmxr_detach_ln routine. The is to be used when a mux wants to dynamically change the number of lines it supports. It should explicitly detach an previously configured lines which won't exist after the change prior to changing the line count. --- sim_tmxr.c | 20 +++++++++++++++----- sim_tmxr.h | 1 + 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/sim_tmxr.c b/sim_tmxr.c index 870bbcb7..c7e35ba4 100644 --- a/sim_tmxr.c +++ b/sim_tmxr.c @@ -65,6 +65,7 @@ tmxr_poll_conn - poll for connection tmxr_reset_ln - reset line (drops Telnet/tcp and serial connections) + tmxr_detach_ln - reset line and close per line listener and outgoing destination tmxr_getc_ln - get character for line tmxr_poll_rx - poll receive tmxr_putc_ln - put character for line @@ -1488,6 +1489,13 @@ if (lp->serport) { /* close current serial connection * } } +t_stat tmxr_detach_ln (TMLN *lp) +{ +tmxr_debug_trace_line (lp, "tmxr_detaach_ln()"); +_mux_detach_line (lp, TRUE, TRUE); +return SCPE_OK; +} + /* Open a master listening socket (and all of the other variances of connections). A listening socket for the port number described by "cptr" is opened for the @@ -2642,6 +2650,8 @@ else { lp = mp->ldsc + j; if (mp->lines > 1) { fprintf (st, "Line: %d", j); + if (mp->notelnet != lp->notelnet) + fprintf (st, " - %telnet", lp->notelnet ? "no" : ""); if (lp->uptr && (lp->uptr != lp->mp->uptr)) fprintf (st, " - Unit: %s", sim_uname (lp->uptr)); fprintf (st, "\n"); @@ -2681,17 +2691,17 @@ for (i = 0; i < mp->lines; i++) { /* loop thru conn */ tmxr_report_disconnection (lp); /* report disconnection */ tmxr_reset_ln (lp); } - if (lp->connecting) { - lp->sock = lp->connecting; - lp->connecting = 0; - tmxr_reset_ln (lp); - } if (lp->serport) { sim_control_serial (lp->serport, 0, TMXR_MDM_DTR|TMXR_MDM_RTS, NULL);/* drop DTR and RTS */ tmxr_close_ln (lp); } free (lp->destination); lp->destination = NULL; + if (lp->connecting) { + lp->sock = lp->connecting; + lp->connecting = 0; + tmxr_reset_ln (lp); + } lp->conn = FALSE; } if (lp->master) { diff --git a/sim_tmxr.h b/sim_tmxr.h index ace37779..6901ba68 100644 --- a/sim_tmxr.h +++ b/sim_tmxr.h @@ -152,6 +152,7 @@ struct tmxr { int32 tmxr_poll_conn (TMXR *mp); t_stat tmxr_reset_ln (TMLN *lp); +t_stat tmxr_detach_ln (TMLN *lp); int32 tmxr_getc_ln (TMLN *lp); void tmxr_poll_rx (TMXR *mp); t_stat tmxr_putc_ln (TMLN *lp, int32 chr);