diff options
author | paulo <paul@bayleaf.org.uk> | 2009-12-09 13:03:24 +0000 |
---|---|---|
committer | paulo <paul@bayleaf.org.uk> | 2009-12-09 13:03:24 +0000 |
commit | 052ac33cebca8347163998f8be997cc9548004bb (patch) | |
tree | 2747c48e2a96ff9aec9f3ff601f0ba8db0ca74dd | |
parent | f24f220c54649d7a3098cb1aeaed87cac9d28053 (diff) | |
download | quagga-052ac33cebca8347163998f8be997cc9548004bb.tar.bz2 quagga-052ac33cebca8347163998f8be997cc9548004bb.tar.xz |
Fix timeouts in nexus, fix LOCK in vty
-rw-r--r-- | lib/qpnexus.c | 16 | ||||
-rw-r--r-- | lib/qpnexus.h | 2 | ||||
-rw-r--r-- | lib/vty.c | 4 |
3 files changed, 13 insertions, 9 deletions
diff --git a/lib/qpnexus.c b/lib/qpnexus.c index 8e5b873d..8b2e9332 100644 --- a/lib/qpnexus.c +++ b/lib/qpnexus.c @@ -90,8 +90,17 @@ qpn_start(void* arg) while (!qpn->terminate) { + qtime_t now = qtimer_time_now(); + + /* process timers */ + while (qtimer_pile_dispatch_next(qpn->pile, now)) + { + } + /* block for some input, output or timeout */ - actions = qps_pselect(qpn->selection, qtimer_pile_top_time(qpn->pile, MAX_PSELECT_TIMOUT)); + actions = qps_pselect(qpn->selection, + qtimer_pile_top_time(qpn->pile, + qtimer_time_future(now + QTIME(MAX_PSELECT_TIMOUT)))); if (actions < 0) { zabort_errno("qps_pselect failed"); @@ -103,11 +112,6 @@ qpn_start(void* arg) actions = qps_dispatch_next(qpn->selection) ; } - /* process timers */ - while (qtimer_pile_dispatch_next(qpn->pile, qtimer_time_now())) - { - } - /* TODO process message queue */ } diff --git a/lib/qpnexus.h b/lib/qpnexus.h index 6c524865..ce546edd 100644 --- a/lib/qpnexus.h +++ b/lib/qpnexus.h @@ -48,7 +48,7 @@ */ /* maximum time in seconds to sit in a pselect */ -#define MAX_PSELECT_TIMOUT QTIME(10) +#define MAX_PSELECT_TIMOUT 10 /*============================================================================== * Data Structures. @@ -2244,8 +2244,8 @@ vty_serv_un (const char *path) void int vtysh_accept_r (qps_file qf, void* file_info) { - LOCK int accept_sock = qf->fd; + LOCK utysh_accept (accept_sock); UNLOCK } @@ -2254,8 +2254,8 @@ vtysh_accept_r (qps_file qf, void* file_info) static int vtysh_accept (struct thread *thread) { - LOCK int accept_sock = THREAD_FD (thread); + LOCK result = utysh_accept (accept_sock); UNLOCK return result; |