From 5da0d954c404f781d182b9559c2e24d28da66f77 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Mon, 25 Jan 2016 05:00:07 -0800 Subject: [PATCH] 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. --- sim_tmxr.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sim_tmxr.c b/sim_tmxr.c index 49b8d9bf..c4fa1320 100644 --- a/sim_tmxr.c +++ b/sim_tmxr.c @@ -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,8 +1408,11 @@ 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 */