MUX: Add line disconnect message when a simulated line is dropped due to DTR transition,

To promote clarity of experience, a user on a telnet connected line (which
supports modem control signaling) will receive a "Disconnected from
{simulator name}" message when a session is explicitly terminated by the
simulated system.  This allows the user to differentiate that case from the
simulator merely being powered off or otherwise crashing.  This behavior
mirrors the "Connected to the {simulator name}" message that is presented
when the connection is established.
This commit is contained in:
Mark Pizzolato 2016-01-25 05:00:07 -08:00
parent d8f2647f93
commit 5da0d954c4

View file

@ -560,7 +560,7 @@ static void tmxr_report_disconnection (TMLN *lp)
{
if (lp->notelnet)
return;
tmxr_linemsgf (lp, "\nDisconnected from the %s simulator\n\n", sim_name);/* report disconnection */
tmxr_linemsgf (lp, "\r\nDisconnected from the %s simulator\r\n\n", sim_name);/* report disconnection */
return;
}
@ -1408,9 +1408,12 @@ if (lp->mp && lp->modem_control) { /* This API ONLY works on mo
if (lp->serport)
return sim_control_serial (lp->serport, bits_to_set, bits_to_clear, incoming_bits);
if ((lp->sock) || (lp->connecting)) {
if (bits_to_clear&TMXR_MDM_DTR) /* drop DTR? */
if (bits_to_clear&TMXR_MDM_DTR) { /* drop DTR? */
if (lp->sock)
tmxr_report_disconnection (lp); /* report closure */
tmxr_reset_ln (lp);
}
}
else {
if ((lp->destination) && /* Virtual Null Modem Cable */
((bits_to_set ^ before_modem_bits) & /* and DTR being Raised */