]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
Fix handling on full pipe to client in bird. Prevent packet overflows
authorMartin Mares <mj@ucw.cz>
Mon, 31 May 2004 17:55:30 +0000 (17:55 +0000)
committerMartin Mares <mj@ucw.cz>
Mon, 31 May 2004 17:55:30 +0000 (17:55 +0000)
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)

client/client.c
sysdep/unix/main.c

index f1c73c4307a2f134291b60874bc9631624b009b7..836941fd4163076ad15cb036060a3b899507e85b 100644 (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
index e16eb699ec456c5136d1add445e743073f214c32..75852c18f2eb88205a691c08bd1e86b043c022b3 100644 (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;
 }