outputs. It took a whole evening to hunt them down, but now the CLI seems
to work fine.
Now I run three BGP connections with several thousand routes!
c->tx_write->next = o;
else
c->tx_buf = o;
- o->next = NULL;
o->wpos = o->outpos = o->buf;
o->end = o->buf + CLI_TX_BUF_SIZE;
}
c->tx_write = o;
if (!c->tx_pos)
c->tx_pos = o;
+ o->next = NULL;
}
o->wpos += size;
return o->wpos - size;
if (o = c->tx_buf)
{
- c->tx_write = c->tx_pos = NULL;
o->wpos = o->outpos = o->buf;
while (p = o->next)
{
mb_free(p);
}
}
+ c->tx_write = c->tx_pos = NULL;
c->async_msg_size = 0;
}
cli_printf(c, 9001, f.err_msg);
}
-static int
+static void
cli_event(void *data)
{
cli *c = data;
{
err = cli_get_command(c);
if (!err)
- return 0;
+ return;
if (err < 0)
cli_printf(c, 9000, "Command too long");
else
if (cli_write(c))
{
cli_free_out(c);
- return 1;
+ ev_schedule(c->event);
}
- return 0;
}
cli *
case SK_DELETED:
return;
default:
- while (s->ttx != s->tbuf && sk_maybe_write(s) > 0)
+ while (s->ttx != s->tpos && sk_maybe_write(s) > 0)
s->tx_hook(s);
}
}
struct cli_out *o = c->tx_pos;
c->tx_pos = o->next;
s->tbuf = o->outpos;
- return sk_send(s, o->wpos - o->outpos);
+ if (sk_send(s, o->wpos - o->outpos) > 0)
+ ev_schedule(c->event);
}
- return 1;
+ return !c->tx_pos;
}
int