netio
parent_handle_xfrd_command(netio_type *ATTR_UNUSED(netio),
parent_handle_child_command(netio_type *ATTR_UNUSED(netio),
parent_handle_reload_command(netio_type *ATTR_UNUSED(netio),
void parent_handle_xfrd_command(netio_type *netio,
void parent_handle_reload_command(netio_type *netio,
void parent_handle_child_command(netio_type *netio,
timeval_to_timespec(&netio->cached_current_time, ¤t_timeval);
netio->have_current_time = 1;
return &netio->cached_current_time;
netio_dispatch(netio_type *netio, const struct timespec *timeout, const sigset_t *sigmask)
assert(netio);
netio->have_current_time = 0;
for (elt = netio->handlers; elt; elt = elt->next) {
timespec_subtract(&relative, netio_current_time(netio));
timeout_handler->event_handler(netio, timeout_handler, NETIO_EVENT_TIMEOUT);
netio->have_current_time = 0;
timeout_handler->event_handler(netio, timeout_handler, NETIO_EVENT_TIMEOUT);
assert(netio->dispatch_next == NULL);
for (elt = netio->handlers; elt && rc; ) {
netio->dispatch_next = elt->next;
handler->event_handler(netio, handler, event_types & handler->event_types);
elt = netio->dispatch_next;
netio->dispatch_next = NULL;
netio_add_handler(netio_type *netio, netio_handler_type *handler)
assert(netio);
if (netio->deallocated) {
elt = netio->deallocated;
netio->deallocated = elt->next;
netio->region, sizeof(netio_handler_list_type));
elt->next = netio->handlers;
netio->handlers = elt;
netio_remove_handler(netio_type *netio, netio_handler_type *handler)
assert(netio);
for (elt_ptr = &netio->handlers; *elt_ptr; elt_ptr = &(*elt_ptr)->next) {
if ((*elt_ptr) == netio->dispatch_next)
netio->dispatch_next = next;
(*elt_ptr)->next = netio->deallocated;
netio->deallocated = *elt_ptr;
netio_current_time(netio_type *netio)
assert(netio);
if (!netio->have_current_time) {
void netio_add_handler(netio_type *netio, netio_handler_type *handler);
void netio_remove_handler(netio_type *netio, netio_handler_type *handler);
const struct timespec *netio_current_time(netio_type *netio);
int netio_dispatch(netio_type *netio,
typedef struct netio netio_type;
typedef void (*netio_event_handler_type)(netio_type *netio,
server_start_children(struct nsd *nsd, region_type* region, netio_type* netio,
return restart_child_servers(nsd, region, netio, xfrd_sock_p);
server_reload(struct nsd *nsd, region_type* server_region, netio_type* netio,
if (server_start_children(nsd, server_region, netio, &nsd->
netio_type *netio = netio_create(server_region);
netio_add_handler(netio, nsd->xfrd_listener);
if (server_start_children(nsd, server_region, netio,
restart_child_servers(nsd, server_region, netio,
netio_remove_handler(netio, &reload_listener);
if(netio_dispatch(netio, &timeout_spec, 0) == -1) {
restart_child_servers(nsd, server_region, netio,
netio_remove_handler(netio, &reload_listener);
server_reload(nsd, server_region, netio
netio_add_handler(netio, &reload_listener);
restart_child_servers(struct nsd *nsd, region_type* region, netio_type* netio,
netio_add_handler(netio, nsd->children[i].handler);