diff options
author | Chris Hall <GMCH@hestia.halldom.com> | 2010-05-27 21:09:56 +0100 |
---|---|---|
committer | Chris Hall <GMCH@hestia.halldom.com> | 2010-05-27 21:09:56 +0100 |
commit | d0dcbe07baffdbff39521e5ae8eca3f80a8d6f3e (patch) | |
tree | 399779682d9449b2376364cf9338891e6b674e85 /lib/qpnexus.c | |
parent | 76c460a85aa0aea7dc90948f3b52979d09f94812 (diff) | |
download | quagga-d0dcbe07baffdbff39521e5ae8eca3f80a8d6f3e.tar.bz2 quagga-d0dcbe07baffdbff39521e5ae8eca3f80a8d6f3e.tar.xz |
Adjustments to scheduling of Routing Engine work.
These changes mean that Quagga copes a little better when there are
very large numbers of updates/withrawal messages arriving all at
once...
...it is not possible to cure the problem of overloading Quagga by
throwing too much at it. However, these changes at least mean that
when BGP sessions drop, the Routing Engine will notice that in a
reasonable time, and can clear up all routes associated with
the session (throwing away any updates/withdraws already received,
but not yet dealt with.)
Amonst these changes are Chris Caputo's patches for bgp_node locking
issues -- see quagga-dev 7960 mailing list message.
Diffstat (limited to 'lib/qpnexus.c')
-rw-r--r-- | lib/qpnexus.c | 34 |
1 files changed, 14 insertions, 20 deletions
diff --git a/lib/qpnexus.c b/lib/qpnexus.c index e568e7d8..59dcc535 100644 --- a/lib/qpnexus.c +++ b/lib/qpnexus.c @@ -191,29 +191,23 @@ qpn_start(void* arg) done = 1 ; while (!qpn->terminate) { - wait = (done == 0) ; /* may wait this time only if nothing - found to do on the last pass */ - - /* Signals are highest priority -- only execute for main thread - * - * Restarts "done" for this pass. - */ + /* Signals are highest priority -- only execute for main thread */ if (qpn->main_thread) - done = quagga_sigevent_process() ; - else - done = 0 ; + done |= quagga_sigevent_process() ; /* Foreground hooks, if any. */ for (i = 0; i < qpn->foreground.count ;) done |= ((qpn_hook_function*)(qpn->foreground.hooks[i++]))() ; - /* drain the message queue, will be in waiting for signal state - * when it's empty */ - - if (done != 0) - wait = 0 ; /* turn off wait if found something */ - - while (1) + /* take stuff from the message queue + * + * If nothing done the last time around the loop then may wait this + * time if the queue is empty first time through. + */ + wait = (done == 0) ; /* may wait this time only if nothing + found to do on the last pass */ + done = 0 ; + do { mqb = mqueue_dequeue(qpn->queue, wait, qpn->mts) ; if (mqb == NULL) @@ -221,9 +215,9 @@ qpn_start(void* arg) mqb_dispatch(mqb, mqb_action); - done = 1 ; /* done something */ - wait = 0 ; /* turn off wait */ - } ; + ++done ; /* done another */ + wait = 0 ; /* done something, so turn off wait */ + } while (done < 200) ; /* block for some input, output, signal or timeout * |