diff options
author | Ondrej Zajicek <santiago@crfreenet.org> | 2009-10-11 18:56:16 +0200 |
---|---|---|
committer | Ondrej Zajicek <santiago@crfreenet.org> | 2009-10-11 18:56:16 +0200 |
commit | ea89da381fc682155e7d08d6ad3d4ac8aa5fe115 (patch) | |
tree | 169955732d5886614af061e9472473b01fb8904c /proto | |
parent | 7ea5b00f42bd3d1fdafb0be349e3ebbcdf3ea466 (diff) |
Workaround for stupid callback scheduler.
There is no reak callback scheduler and previous behavior causes
bad things during hard congestion (like BGP hold timeouts).
Smart callback scheduler is still missing, but main loop was
changed such that it first processes all tx callbacks (which
are fast enough) (but max 4* per socket) + rx callbacks for CLI,
and in the second phase it processes one rx callback per
socket up to four sockets (as rx callback can be slow when
there are too many protocols, because route redistribution
is done synchronously inside rx callback). If there is event
callback ready, second phase is skipped in 90% of iterations
(to speed up CLI during congestion).
Diffstat (limited to 'proto')
-rw-r--r-- | proto/bgp/bgp.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/proto/bgp/bgp.c b/proto/bgp/bgp.c index af5dbfcb..b76b7f97 100644 --- a/proto/bgp/bgp.c +++ b/proto/bgp/bgp.c @@ -431,8 +431,15 @@ bgp_hold_timeout(timer *t) { struct bgp_conn *conn = t->data; - DBG("BGP: Hold timeout, closing connection\n"); - bgp_error(conn, 4, 0, NULL, 0); + DBG("BGP: Hold timeout\n"); + + /* If there is something in input queue, we are probably congested + and perhaps just not processed BGP packets in time. */ + + if (sk_rx_ready(conn->sk) > 0) + bgp_start_timer(conn->hold_timer, 10); + else + bgp_error(conn, 4, 0, NULL, 0); } static void |