This file describes the worker structure that holds a list of pending requests and handles them. More...
#include "libunbound/worker.h"
#include "util/netevent.h"
#include "util/locks.h"
#include "util/alloc.h"
#include "util/data/msgreply.h"
#include "util/data/msgparse.h"
#include "daemon/stats.h"
#include "util/module.h"
#include "dnstap/dnstap.h"
Data Structures | |
struct | worker |
Structure holding working information for unbound. More... | |
Enumerations | |
enum | worker_commands { worker_cmd_quit , worker_cmd_stats , worker_cmd_stats_noreset , worker_cmd_remote } |
worker commands More... | |
Functions | |
struct worker * | worker_create (struct daemon *daemon, int id, int *ports, int n) |
Create the worker structure. More... | |
int | worker_init (struct worker *worker, struct config_file *cfg, struct listen_port *ports, int do_sigs) |
Initialize worker. More... | |
void | worker_work (struct worker *worker) |
Make worker work. | |
void | worker_delete (struct worker *worker) |
Delete worker. | |
void | worker_send_cmd (struct worker *worker, enum worker_commands cmd) |
Send a command to a worker. More... | |
void | worker_stats_clear (struct worker *worker) |
Init worker stats - includes server_stats_init, outside network and mesh. More... | |
This file describes the worker structure that holds a list of pending requests and handles them.
enum worker_commands |
Create the worker structure.
Bare bones version, zeroed struct, with backpointers only. Use worker_init on it later.
daemon | the daemon that this worker thread is part of. |
id | the thread number from 0.. numthreads-1. |
ports | the ports it is allowed to use, array. |
n | the number of ports. |
References worker::cmd, worker::daemon, log_err(), memdup(), worker::numports, worker::ports, daemon::rand, worker::rndstate, worker::thread_num, tube_create(), tube_delete(), and ub_initstate().
int worker_init | ( | struct worker * | worker, |
struct config_file * | cfg, | ||
struct listen_port * | ports, | ||
int | do_sigs | ||
) |
Initialize worker.
Allocates event base, listens to ports
worker | worker to initialize, created with worker_create. |
cfg | configuration settings. |
ports | list of shared query ports. |
do_sigs | if true, worker installs signal handlers. |
References worker::base, and worker::need_to_exit.
Referenced by thread_start().
void worker_send_cmd | ( | struct worker * | worker, |
enum worker_commands | cmd | ||
) |
Send a command to a worker.
Uses blocking writes.
worker | worker to send command to. |
cmd | command to send. |
References worker::cmd, log_err(), and tube_write_msg().
Referenced by daemon_stop_others(), distribute_cmd(), and server_stats_obtain().
void worker_stats_clear | ( | struct worker * | worker | ) |
Init worker stats - includes server_stats_init, outside network and mesh.
worker | the worker to init |
References worker::back, module_env::cfg, worker::env, module_env::mesh, mesh_stats_clear(), outside_network::num_tcp_outgoing, outside_network::num_udp_outgoing, server_stats_init(), worker::stats, and outside_network::unwanted_replies.
Referenced by do_flush_stats().