Commit a08ce38b authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpd: Cache date by comparing ev_now

parent 5d204fc3
...@@ -1329,20 +1329,9 @@ void worker_acceptcb(struct ev_loop *loop, ev_async *w, int revents) { ...@@ -1329,20 +1329,9 @@ void worker_acceptcb(struct ev_loop *loop, ev_async *w, int revents) {
} }
} // namespace } // namespace
namespace {
void refresh_cb(struct ev_loop *loop, ev_timer *w, int revents) {
auto sessions = static_cast<Sessions *>(w->data);
sessions->update_cached_date();
}
} // namespace
namespace { namespace {
void run_worker(Worker *worker) { void run_worker(Worker *worker) {
auto loop = worker->sessions->get_loop(); auto loop = worker->sessions->get_loop();
ev_timer w;
ev_timer_init(&w, refresh_cb, 0., 1.);
w.data = worker->sessions.get();
ev_timer_again(loop, &w);
worker->sessions->update_cached_date(); worker->sessions->update_cached_date();
ev_run(loop, 0); ev_run(loop, 0);
...@@ -1672,11 +1661,7 @@ int HttpServer::run() { ...@@ -1672,11 +1661,7 @@ int HttpServer::run() {
return -1; return -1;
} }
ev_timer refresh_timer;
ev_timer_init(&refresh_timer, refresh_cb, 0., 1.);
refresh_timer.data = &sessions;
if (config_->num_worker == 1) { if (config_->num_worker == 1) {
ev_timer_again(loop, &refresh_timer);
sessions.update_cached_date(); sessions.update_cached_date();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment