From 1213f098e20079b09c11d1c06ac88ef7f511a7c6 Mon Sep 17 00:00:00 2001 From: Mark Pizzolato Date: Fri, 11 Jan 2013 16:34:05 -0800 Subject: [PATCH] Fixed Buffered Console behavior which ended up flushing buffer contents once a second and clearing the buffer. We were also incorrectly flushing buffer contents when a connection dropped. --- sim_console.c | 3 ++- sim_tmxr.c | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/sim_console.c b/sim_console.c index 58fd6b97..21782751 100644 --- a/sim_console.c +++ b/sim_console.c @@ -186,7 +186,8 @@ if ((sim_con_tmxr.master == 0) && /* not Telnet and not se if (tmxr_poll_conn (&sim_con_tmxr) >= 0) /* poll connect */ sim_con_ldsc.rcve = 1; /* rcv enabled */ sim_activate_after(uptr, 1000000); /* check again in 1 second */ -tmxr_send_buffered_data (&sim_con_ldsc); /* try to flush any buffered data */ +if (sim_con_ldsc.conn) + tmxr_send_buffered_data (&sim_con_ldsc); /* try to flush any buffered data */ return SCPE_OK; } diff --git a/sim_tmxr.c b/sim_tmxr.c index f2a1fc1f..86079459 100644 --- a/sim_tmxr.c +++ b/sim_tmxr.c @@ -1142,7 +1142,8 @@ for (i = 0; i < mp->lines; i++) { /* loop thru lines */ TMXR_MAXBUF - lp->rxbpi); if (nbytes < 0) { /* line error? */ - lp->txbpi = lp->txbpr = 0; /* Drop the data we already know we can't send */ + if (!lp->txbfd) + lp->txbpi = lp->txbpr = 0; /* Drop the data we already know we can't send */ tmxr_close_ln (lp); /* disconnect line */ }