From: Martin Mares Date: Mon, 31 May 2004 17:55:30 +0000 (+0000) Subject: Fix handling on full pipe to client in bird. Prevent packet overflows X-Git-Tag: v1.2.0~392 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5f2a6a9ff324d846c86ffafb60ae5a4c01d06313;p=thirdparty%2Fbird.git Fix handling on full pipe to client in bird. Prevent packet overflows for even only medium sized route table output. Fix a strange garbled output problem in the client. The latter seems to be caused by some library doing tcflush while there is still command output pending. So the best fix here is to do fflush and then tcdrain. Note that this problem occurs only under certain load situations and is not too easy to reproduce. (by Andreas) --- diff --git a/client/client.c b/client/client.c index f1c73c430..836941fd4 100644 --- a/client/client.c +++ b/client/client.c @@ -281,6 +281,10 @@ server_got_reply(char *x) } else printf("??? <%s>\n", x); + /* need this, otherwise some lib seems to eat pending output when + the prompt is displayed */ + fflush(stdout); + tcdrain(fileno(stdout)); } static void diff --git a/sysdep/unix/main.c b/sysdep/unix/main.c index e16eb699e..75852c18f 100644 --- a/sysdep/unix/main.c +++ b/sysdep/unix/main.c @@ -183,10 +183,12 @@ cli_write(cli *c) if (c->tx_pos) { struct cli_out *o = c->tx_pos; - c->tx_pos = o->next; s->tbuf = o->outpos; if (sk_send(s, o->wpos - o->outpos) > 0) - ev_schedule(c->event); + { + c->tx_pos = o->next; + ev_schedule(c->event); + } } return !c->tx_pos; }