mirror of
https://github.com/NLnetLabs/unbound.git
synced 2025-12-26 09:39:43 -05:00
- For dnstap, do not wakeupnow right there. Instead zero the timer to
force the wakeup callback asap.
This commit is contained in:
parent
c7ae3ef156
commit
8e76eb95a0
2 changed files with 19 additions and 10 deletions
|
|
@ -188,9 +188,9 @@ mq_wakeup_cb(void* arg)
|
||||||
|
|
||||||
/** start timer to wakeup dtio because there is content in the queue */
|
/** start timer to wakeup dtio because there is content in the queue */
|
||||||
static void
|
static void
|
||||||
dt_msg_queue_start_timer(struct dt_msg_queue* mq)
|
dt_msg_queue_start_timer(struct dt_msg_queue* mq, int wakeupnow)
|
||||||
{
|
{
|
||||||
struct timeval tv;
|
struct timeval tv = {0};
|
||||||
/* Start a timer to process messages to be logged.
|
/* Start a timer to process messages to be logged.
|
||||||
* If we woke up the dtio thread for every message, the wakeup
|
* If we woke up the dtio thread for every message, the wakeup
|
||||||
* messages take up too much processing power. If the queue
|
* messages take up too much processing power. If the queue
|
||||||
|
|
@ -204,19 +204,26 @@ dt_msg_queue_start_timer(struct dt_msg_queue* mq)
|
||||||
|
|
||||||
/* do not start the timer if a timer already exists, perhaps
|
/* do not start the timer if a timer already exists, perhaps
|
||||||
* in another worker. So this variable is protected by a lock in
|
* in another worker. So this variable is protected by a lock in
|
||||||
* dtio */
|
* dtio. */
|
||||||
|
|
||||||
|
/* If we need to wakeupnow, 0 the timer to force the callback. */
|
||||||
lock_basic_lock(&mq->dtio->wakeup_timer_lock);
|
lock_basic_lock(&mq->dtio->wakeup_timer_lock);
|
||||||
if(mq->dtio->wakeup_timer_enabled) {
|
if(mq->dtio->wakeup_timer_enabled) {
|
||||||
|
if(wakeupnow) {
|
||||||
|
comm_timer_set(mq->wakeup_timer, &tv);
|
||||||
|
}
|
||||||
lock_basic_unlock(&mq->dtio->wakeup_timer_lock);
|
lock_basic_unlock(&mq->dtio->wakeup_timer_lock);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mq->dtio->wakeup_timer_enabled = 1; /* we are going to start one */
|
mq->dtio->wakeup_timer_enabled = 1; /* we are going to start one */
|
||||||
lock_basic_unlock(&mq->dtio->wakeup_timer_lock);
|
|
||||||
|
|
||||||
/* start the timer, in mq, in the event base of our worker */
|
/* start the timer, in mq, in the event base of our worker */
|
||||||
tv.tv_sec = 1;
|
if(!wakeupnow) {
|
||||||
tv.tv_usec = 0;
|
tv.tv_sec = 1;
|
||||||
|
tv.tv_usec = 0;
|
||||||
|
}
|
||||||
comm_timer_set(mq->wakeup_timer, &tv);
|
comm_timer_set(mq->wakeup_timer, &tv);
|
||||||
|
lock_basic_unlock(&mq->dtio->wakeup_timer_lock);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -283,10 +290,8 @@ dt_msg_queue_submit(struct dt_msg_queue* mq, void* buf, size_t len)
|
||||||
/* release lock */
|
/* release lock */
|
||||||
lock_basic_unlock(&mq->lock);
|
lock_basic_unlock(&mq->lock);
|
||||||
|
|
||||||
if(wakeupnow) {
|
if(wakeupnow || wakeupstarttimer) {
|
||||||
dtio_wakeup(mq->dtio);
|
dt_msg_queue_start_timer(mq, wakeupnow);
|
||||||
} else if(wakeupstarttimer) {
|
|
||||||
dt_msg_queue_start_timer(mq);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,7 @@
|
||||||
|
19 January 2022: George
|
||||||
|
- For dnstap, do not wakeupnow right there. Instead zero the timer to
|
||||||
|
force the wakeup callback asap.
|
||||||
|
|
||||||
14 January 2022: George
|
14 January 2022: George
|
||||||
- Merge PR #605:
|
- Merge PR #605:
|
||||||
- Fix EDNS to upstream where the same option could be attached
|
- Fix EDNS to upstream where the same option could be attached
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue