Fixed error paths during attach/detach and fixed a per line listen detach bug
This commit is contained in:
parent
722524c20e
commit
b78c91b4db
1 changed files with 11 additions and 12 deletions
23
sim_tmxr.c
23
sim_tmxr.c
|
@ -1622,20 +1622,18 @@ while (*tptr) {
|
||||||
mp->notelnet = listennotelnet; /* save desired telnet behavior flag */
|
mp->notelnet = listennotelnet; /* save desired telnet behavior flag */
|
||||||
for (i = 0; i < mp->lines; i++) { /* initialize lines */
|
for (i = 0; i < mp->lines; i++) { /* initialize lines */
|
||||||
lp = mp->ldsc + i;
|
lp = mp->ldsc + i;
|
||||||
|
|
||||||
if (lp->serport == 0) { /* no serial port attached? */
|
|
||||||
lp->mp = mp; /* set the back pointer */
|
lp->mp = mp; /* set the back pointer */
|
||||||
tmxr_init_line (lp); /* initialize line state */
|
|
||||||
lp->sock = 0; /* clear the socket */
|
if (lp->serport) { /* serial port attached? */
|
||||||
}
|
tmxr_reset_ln (lp); /* close current serial connection */
|
||||||
else { /* close current serial connection */
|
|
||||||
tmxr_reset_ln (lp);
|
|
||||||
sim_control_serial (lp->serport, 0, TMXR_MDM_DTR|TMXR_MDM_RTS, NULL);/* drop DTR and RTS */
|
sim_control_serial (lp->serport, 0, TMXR_MDM_DTR|TMXR_MDM_RTS, NULL);/* drop DTR and RTS */
|
||||||
sim_close_serial (lp->serport);
|
sim_close_serial (lp->serport);
|
||||||
lp->serport = 0;
|
lp->serport = 0;
|
||||||
free (lp->serconfig);
|
free (lp->serconfig);
|
||||||
lp->serconfig = NULL;
|
lp->serconfig = NULL;
|
||||||
}
|
}
|
||||||
|
tmxr_init_line (lp); /* initialize line state */
|
||||||
|
lp->sock = 0; /* clear the socket */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (destination[0]) {
|
if (destination[0]) {
|
||||||
|
@ -2052,11 +2050,6 @@ for (i = 0; i < mp->lines; i++) { /* loop thru conn */
|
||||||
if (!lp->destination && lp->sock) { /* not serial and is connected? */
|
if (!lp->destination && lp->sock) { /* not serial and is connected? */
|
||||||
tmxr_report_disconnection (lp); /* report disconnection */
|
tmxr_report_disconnection (lp); /* report disconnection */
|
||||||
tmxr_reset_ln (lp); /* disconnect line */
|
tmxr_reset_ln (lp); /* disconnect line */
|
||||||
if (lp->master)
|
|
||||||
sim_close_sock (mp->master, 1); /* close master socket */
|
|
||||||
lp->master = 0;
|
|
||||||
free (lp->port);
|
|
||||||
lp->port = NULL;
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (lp->sock) {
|
if (lp->sock) {
|
||||||
|
@ -2076,6 +2069,12 @@ for (i = 0; i < mp->lines; i++) { /* loop thru conn */
|
||||||
lp->destination = NULL;
|
lp->destination = NULL;
|
||||||
lp->conn = FALSE;
|
lp->conn = FALSE;
|
||||||
}
|
}
|
||||||
|
if (lp->master) {
|
||||||
|
sim_close_sock (lp->master, 1); /* close master socket */
|
||||||
|
lp->master = 0;
|
||||||
|
free (lp->port);
|
||||||
|
lp->port = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mp->master)
|
if (mp->master)
|
||||||
|
|
Loading…
Add table
Reference in a new issue