Freeing the export table is surprisingly expensive. When it's called from bgp_stop()
immediately, it may get called in the main loop while reconfiguring or shutting down,
and that is unnecessarily slow. Moving that code to the bgp_decision() event so that
it can run in threads.
Discovered by randomly checking perf tests.
if ((p->p.proto_state == PS_STOP) &&
(p->outgoing_conn.state == BS_IDLE) &&
(p->incoming_conn.state == BS_IDLE))
+ {
+ struct bgp_channel *c;
+ BGP_WALK_CHANNELS(p, c)
+ bgp_free_pending_tx(c);
+
bgp_down(p);
+ }
}
static void
p->p.reload_routes = NULL;
- struct bgp_channel *c;
- BGP_WALK_CHANNELS(p, c)
- bgp_free_pending_tx(c);
-
proto_send_event(&p->p, p->event);
}