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)
This commit is contained in:
Martin Mares 2004-05-31 17:55:30 +00:00
parent a4ffe2739d
commit 5f2a6a9ff3
2 changed files with 8 additions and 2 deletions

View file

@ -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

View file

@ -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;
}