Commit 0ac3aa01 authored by Juliusz Chroboczek's avatar Juliusz Chroboczek

Allocate larger buffers for unsent updates.

We used to allocate enough buffer space to send one full-size frame.
Unfortunately, in large networks this causes our update coalescing
strategy to fail, just where it is the most useful.  Allocate enough
buffers to fit a full update.
parent 2a211b9b
......@@ -1061,12 +1061,17 @@ buffer_update(struct interface *ifp,
if(ifp->update_bufsize == 0) {
int n;
assert(ifp->buffered_updates == NULL);
n = MAX(ifp->bufsize / 16, 4);
/* Allocate enough space to hold a full update. Since the
number of installed routes will grow over time, make sure we
have enough space to send a full-ish frame. */
n = installed_routes_estimate() + xroutes_estimate() + 4;
n = MAX(n, ifp->bufsize / 16);
again:
ifp->buffered_updates = malloc(n * sizeof(struct buffered_update));
if(ifp->buffered_updates == NULL) {
perror("malloc(buffered_updates)");
if(n > 4) {
/* Try again with a tiny buffer. */
n = 4;
goto again;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment