Lines Matching refs:xfrd
53 xfrd_state_type* xfrd = 0; variable
121 if(event_base_set(xfrd->event_base, ev) != 0) { in xfrd_sigsetup()
135 assert(xfrd == 0); in xfrd_init()
141 xfrd = (xfrd_state_type*)region_alloc(region, sizeof(xfrd_state_type)); in xfrd_init()
142 memset(xfrd, 0, sizeof(xfrd_state_type)); in xfrd_init()
143 xfrd->region = region; in xfrd_init()
144 xfrd->xfrd_start_time = time(0); in xfrd_init()
145 xfrd->event_base = nsd_child_event_base(); in xfrd_init()
146 if(!xfrd->event_base) { in xfrd_init()
150 xfrd->nsd = nsd; in xfrd_init()
151 xfrd->packet = buffer_create(xfrd->region, QIOBUFSZ); in xfrd_init()
152 xfrd->udp_waiting_first = NULL; in xfrd_init()
153 xfrd->udp_waiting_last = NULL; in xfrd_init()
154 xfrd->udp_use_num = 0; in xfrd_init()
155 xfrd->got_time = 0; in xfrd_init()
156 xfrd->xfrfilenumber = 0; in xfrd_init()
158 xfrd->zonestat_safe = nsd->zonestatdesired; in xfrd_init()
160 xfrd->activated_first = NULL; in xfrd_init()
161 xfrd->ipc_pass = buffer_create(xfrd->region, QIOBUFSZ); in xfrd_init()
162 xfrd->last_task = region_alloc(xfrd->region, sizeof(*xfrd->last_task)); in xfrd_init()
163 udb_ptr_init(xfrd->last_task, xfrd->nsd->task[xfrd->nsd->mytask]); in xfrd_init()
164 assert(shortsoa || udb_base_get_userdata(xfrd->nsd->task[xfrd->nsd->mytask])->data == 0); in xfrd_init()
166 xfrd->reload_handler.ev_fd = -1; in xfrd_init()
167 xfrd->reload_added = 0; in xfrd_init()
168 xfrd->reload_timeout.tv_sec = 0; in xfrd_init()
169 xfrd->reload_cmd_last_sent = xfrd->xfrd_start_time; in xfrd_init()
170 xfrd->reload_cmd_first_sent = 0; in xfrd_init()
171 xfrd->reload_failed = 0; in xfrd_init()
172 xfrd->can_send_reload = !reload_active; in xfrd_init()
173 xfrd->reload_pid = nsd_pid; in xfrd_init()
174 xfrd->child_timer_added = 0; in xfrd_init()
176 xfrd->ipc_send_blocked = 0; in xfrd_init()
177 memset(&xfrd->ipc_handler, 0, sizeof(xfrd->ipc_handler)); in xfrd_init()
178 event_set(&xfrd->ipc_handler, socket, EV_PERSIST|EV_READ, in xfrd_init()
179 xfrd_handle_ipc, xfrd); in xfrd_init()
180 if(event_base_set(xfrd->event_base, &xfrd->ipc_handler) != 0) in xfrd_init()
182 if(event_add(&xfrd->ipc_handler, NULL) != 0) in xfrd_init()
184 xfrd->ipc_handler_flags = EV_PERSIST|EV_READ; in xfrd_init()
185 xfrd->ipc_conn = xfrd_tcp_create(xfrd->region, QIOBUFSZ); in xfrd_init()
187 xfrd->ipc_conn->is_reading = 0; in xfrd_init()
188 xfrd->ipc_conn->fd = socket; in xfrd_init()
189 xfrd->need_to_send_reload = 0; in xfrd_init()
190 xfrd->need_to_send_shutdown = 0; in xfrd_init()
191 xfrd->need_to_send_stats = 0; in xfrd_init()
193 xfrd->write_zonefile_needed = 0; in xfrd_init()
197 xfrd->notify_waiting_first = NULL; in xfrd_init()
198 xfrd->notify_waiting_last = NULL; in xfrd_init()
199 xfrd->notify_udp_num = 0; in xfrd_init()
201 daemon_remote_attach(xfrd->nsd->rc, xfrd); in xfrd_init()
203 …xfrd->tcp_set = xfrd_tcp_set_create(xfrd->region, nsd->options->tls_cert_bundle, nsd->options->xfr… in xfrd_init()
204 xfrd->tcp_set->tcp_timeout = nsd->tcp_timeout; in xfrd_init()
213 xfrd_read_state(xfrd); in xfrd_init()
245 while((zone = xfrd->activated_first)) { in xfrd_process_activated()
249 xfrd->activated_first = zone->activated_next; in xfrd_process_activated()
265 if(xfrd->nsd->signal_hint_quit || xfrd->nsd->signal_hint_shutdown) { in xfrd_sig_process()
266 xfrd->nsd->signal_hint_quit = 0; in xfrd_sig_process()
267 xfrd->nsd->signal_hint_shutdown = 0; in xfrd_sig_process()
268 xfrd->need_to_send_shutdown = 1; in xfrd_sig_process()
269 if(!(xfrd->ipc_handler_flags&EV_WRITE)) { in xfrd_sig_process()
270 ipc_xfrd_set_listening(xfrd, EV_PERSIST|EV_READ|EV_WRITE); in xfrd_sig_process()
272 } else if(xfrd->nsd->signal_hint_reload_hup) { in xfrd_sig_process()
274 xfrd->nsd->signal_hint_reload_hup = 0; in xfrd_sig_process()
275 if(xfrd->nsd->options->zonefiles_check) { in xfrd_sig_process()
276 task_new_check_zonefiles(xfrd->nsd->task[ in xfrd_sig_process()
277 xfrd->nsd->mytask], xfrd->last_task, NULL); in xfrd_sig_process()
279 xfrd_set_reload_now(xfrd); in xfrd_sig_process()
280 } else if(xfrd->nsd->signal_hint_statsusr) { in xfrd_sig_process()
281 xfrd->nsd->signal_hint_statsusr = 0; in xfrd_sig_process()
282 xfrd->need_to_send_stats = 1; in xfrd_sig_process()
283 if(!(xfrd->ipc_handler_flags&EV_WRITE)) { in xfrd_sig_process()
284 ipc_xfrd_set_listening(xfrd, EV_PERSIST|EV_READ|EV_WRITE); in xfrd_sig_process()
289 xfrd->nsd->signal_hint_child = 0; in xfrd_sig_process()
296 if(!xfrd->child_timer_added) { in xfrd_sig_process()
300 memset(&xfrd->child_timer, 0, sizeof(xfrd->child_timer)); in xfrd_sig_process()
301 event_set(&xfrd->child_timer, -1, EV_TIMEOUT, in xfrd_sig_process()
302 xfrd_handle_child_timer, xfrd); in xfrd_sig_process()
303 if(event_base_set(xfrd->event_base, &xfrd->child_timer) != 0) in xfrd_sig_process()
305 if(event_add(&xfrd->child_timer, &tv) != 0) in xfrd_sig_process()
307 xfrd->child_timer_added = 1; in xfrd_sig_process()
316 xfrd->shutdown = 0; in xfrd_main()
317 while(!xfrd->shutdown) in xfrd_main()
324 xfrd->got_time = 0; in xfrd_main()
325 if(event_base_loop(xfrd->event_base, EVLOOP_ONCE) == -1) { in xfrd_main()
346 event_del(&xfrd->ipc_handler); in xfrd_shutdown()
347 close(xfrd->ipc_handler.ev_fd); /* notifies parent we stop */ in xfrd_shutdown()
349 if(xfrd->nsd->options->xfrdfile != NULL && xfrd->nsd->options->xfrdfile[0]!=0) in xfrd_shutdown()
350 xfrd_write_state(xfrd); in xfrd_shutdown()
351 if(xfrd->reload_added) { in xfrd_shutdown()
352 event_del(&xfrd->reload_handler); in xfrd_shutdown()
353 xfrd->reload_added = 0; in xfrd_shutdown()
355 if(xfrd->child_timer_added) { in xfrd_shutdown()
356 event_del(&xfrd->child_timer); in xfrd_shutdown()
357 xfrd->child_timer_added = 0; in xfrd_shutdown()
359 if(xfrd->nsd->options->zonefiles_write) { in xfrd_shutdown()
360 event_del(&xfrd->write_timer); in xfrd_shutdown()
362 daemon_remote_close(xfrd->nsd->rc); /* close sockets of rc */ in xfrd_shutdown()
364 RBTREE_FOR(zone, xfrd_zone_type*, xfrd->zones) in xfrd_shutdown()
375 close_notify_fds(xfrd->notify_zones); in xfrd_shutdown()
378 if(xfrd->reload_pid != -1) { in xfrd_shutdown()
380 (int)xfrd->reload_pid)); in xfrd_shutdown()
382 if(waitpid(xfrd->reload_pid, NULL, 0) == -1) { in xfrd_shutdown()
386 (int)xfrd->reload_pid, strerror(errno)); in xfrd_shutdown()
397 RBTREE_FOR(zone, xfrd_zone_type*, xfrd->zones) in xfrd_shutdown()
403 xfrd_unlink_xfrfile(xfrd->nsd, xfr->xfrfilenumber); in xfrd_shutdown()
407 xfrd_clean_pending_tasks(xfrd->nsd, xfrd->nsd->task[xfrd->nsd->mytask]); in xfrd_shutdown()
408 xfrd_del_tempdir(xfrd->nsd); in xfrd_shutdown()
409 daemon_remote_delete(xfrd->nsd->rc); /* ssl-delete secret keys */ in xfrd_shutdown()
411 if (xfrd->nsd->tls_ctx) in xfrd_shutdown()
412 SSL_CTX_free(xfrd->nsd->tls_ctx); in xfrd_shutdown()
414 if (xfrd->tcp_set->ssl_ctx) in xfrd_shutdown()
415 SSL_CTX_free(xfrd->tcp_set->ssl_ctx); in xfrd_shutdown()
425 if(xfrd->nsd->db) { in xfrd_shutdown()
426 namedb_close(xfrd->nsd->db); in xfrd_shutdown()
429 if(xfrd->zones) { in xfrd_shutdown()
431 RBTREE_FOR(z, xfrd_zone_type*, xfrd->zones) { in xfrd_shutdown()
437 if(xfrd->notify_zones) { in xfrd_shutdown()
439 RBTREE_FOR(n, struct notify_zone*, xfrd->notify_zones) { in xfrd_shutdown()
458 event_base_free(xfrd->event_base); in xfrd_shutdown()
459 region_destroy(xfrd->region); in xfrd_shutdown()
484 xfrd_init_slave_zone(xfrd_state_type* xfrd, struct zone_options* zone_opt) in xfrd_init_slave_zone() argument
488 xzone = (xfrd_zone_type*)region_alloc(xfrd->region, in xfrd_init_slave_zone()
539 rbtree_insert(xfrd->zones, (rbnode_type*)xzone); in xfrd_init_slave_zone()
546 assert(xfrd->zones == 0); in xfrd_init_zones()
548 xfrd->zones = rbtree_create(xfrd->region, in xfrd_init_zones()
550 xfrd->notify_zones = rbtree_create(xfrd->region, in xfrd_init_zones()
552 xfrd->catalog_consumer_zones = rbtree_create(xfrd->region, in xfrd_init_zones()
554 xfrd->catalog_producer_zones = rbtree_create(xfrd->region, in xfrd_init_zones()
557 RBTREE_FOR(zone_opt, struct zone_options*, xfrd->nsd->options->zone_options) in xfrd_init_zones()
565 xfrd_init_catalog_consumer_zone(xfrd, zone_opt); in xfrd_init_zones()
571 init_notify_send(xfrd->notify_zones, xfrd->region, zone_opt); in xfrd_init_zones()
578 xfrd_init_slave_zone(xfrd, zone_opt); in xfrd_init_zones()
581 "secondary zones, %d catalog zones", (int)xfrd->zones->count, in xfrd_init_zones()
582 (int)xfrd->catalog_consumer_zones->count)); in xfrd_init_zones()
633 if(!(df = xfrd_open_xfrfile(xfrd->nsd, xfr->xfrfilenumber, "r"))) { in apply_xfrs_to_consumer_zone()
638 } else if(0 >= apply_ixfr_for_zone(xfrd->nsd, dbzone, df, in apply_xfrs_to_consumer_zone()
639 xfrd->nsd->options, NULL, NULL, xfr->xfrfilenumber)) { in apply_xfrs_to_consumer_zone()
672 zone = (xfrd_zone_type*)rbtree_search(xfrd->zones, task->zname); in xfrd_process_soa_info_task()
719 before = xfrd->reload_cmd_first_sent; in xfrd_process_soa_info_task()
727 rbtree_search(xfrd->catalog_producer_zones, task->zname))) { in xfrd_process_soa_info_task()
747 else if(xfrd->reload_failed) { in xfrd_process_soa_info_task()
755 DIFF_VERIFIED, xfrd->nsd, in xfrd_process_soa_info_task()
763 xfrd_unlink_xfrfile(xfrd->nsd, pxfr->xfrfilenumber); in xfrd_process_soa_info_task()
766 region_recycle(xfrd->region, pxfr, sizeof(*pxfr)); in xfrd_process_soa_info_task()
767 notify_handle_master_zone_soainfo(xfrd->notify_zones, in xfrd_process_soa_info_task()
774 notify_handle_master_zone_soainfo(xfrd->notify_zones, in xfrd_process_soa_info_task()
778 if(xfrd->nsd->db in xfrd_process_soa_info_task()
779 && xfrd->catalog_consumer_zones in xfrd_process_soa_info_task()
781 && xfrd->catalog_consumer_zones->count == 1 in xfrd_process_soa_info_task()
784 xfrd->catalog_consumer_zones, task->zname))) { in xfrd_process_soa_info_task()
785 dbzone = namedb_find_or_create_zone( xfrd->nsd->db, task->zname in xfrd_process_soa_info_task()
812 if(xfrd->reload_failed) { in xfrd_process_soa_info_task()
820 xfrd->nsd, xfr->xfrfilenumber); in xfrd_process_soa_info_task()
868 if(xfrd->reload_failed) in xfrd_process_soa_info_task()
881 struct udb_base* xtask = xfrd->nsd->task[xfrd->nsd->mytask]; in xfrd_receive_soa()
888 RBTREE_FOR(zone, xfrd_zone_type*, xfrd->zones) { in xfrd_receive_soa()
912 if(block_read(NULL, socket, &xfrd->reload_pid, sizeof(pid_t), -1) in xfrd_receive_soa()
918 udb_ptr_unlink(xfrd->last_task, xtask); in xfrd_receive_soa()
921 xfrd->nsd->mytask = 1 - xfrd->nsd->mytask; in xfrd_receive_soa()
922 xtask = xfrd->nsd->task[xfrd->nsd->mytask]; in xfrd_receive_soa()
931 udb_ptr_init(xfrd->last_task, xfrd->nsd->task[xfrd->nsd->mytask]); in xfrd_receive_soa()
948 RBTREE_FOR(zone, xfrd_zone_type*, xfrd->zones) { in xfrd_receive_soa()
959 if (xfrd->nsd->file_rotation_ok) in xfrd_reopen_logfile()
960 log_reopen(xfrd->nsd->log_filename, 0); in xfrd_reopen_logfile()
970 else xfrd->activated_first = z->activated_next; in xfrd_deactivate_zone()
978 xfrd_del_slave_zone(xfrd_state_type* xfrd, const dname_type* dname) in xfrd_del_slave_zone() argument
980 xfrd_zone_type* z = (xfrd_zone_type*)rbtree_delete(xfrd->zones, dname); in xfrd_del_slave_zone()
989 else xfrd->tcp_set->tcp_waiting_first = z->tcp_waiting_next; in xfrd_del_slave_zone()
993 else xfrd->tcp_set->tcp_waiting_last = z->tcp_waiting_prev; in xfrd_del_slave_zone()
1001 else xfrd->udp_waiting_first = z->udp_waiting_next; in xfrd_del_slave_zone()
1005 else xfrd->udp_waiting_last = z->udp_waiting_prev; in xfrd_del_slave_zone()
1010 xfrd_tcp_release(xfrd->tcp_set, z); in xfrd_del_slave_zone()
1020 region_recycle(xfrd->region, z, sizeof(*z)); in xfrd_del_slave_zone()
1116 xfrd_tcp_release(xfrd->tcp_set, zone); in xfrd_handle_zone()
1262 xfrd_set_timer(zone, xfrd->tcp_set->tcp_timeout); in xfrd_make_request()
1263 xfrd_tcp_obtain(xfrd->tcp_set, zone); in xfrd_make_request()
1267 xfrd_set_timer(zone, xfrd->tcp_set->tcp_timeout); in xfrd_make_request()
1268 xfrd_tcp_obtain(xfrd->tcp_set, zone); in xfrd_make_request()
1272 xfrd_set_timer(zone, xfrd->tcp_set->tcp_timeout); in xfrd_make_request()
1273 xfrd_tcp_obtain(xfrd->tcp_set, zone); in xfrd_make_request()
1288 xfrd_tcp_release(xfrd->tcp_set, zone); in xfrd_udp_obtain()
1290 if(xfrd->udp_use_num < XFRD_MAX_UDP) { in xfrd_udp_obtain()
1292 xfrd->udp_use_num++; in xfrd_udp_obtain()
1295 xfrd->udp_use_num--; in xfrd_udp_obtain()
1304 if(event_base_set(xfrd->event_base, &zone->zone_handler) != 0) in xfrd_udp_obtain()
1316 zone->udp_waiting_prev = xfrd->udp_waiting_last; in xfrd_udp_obtain()
1317 if(!xfrd->udp_waiting_first) in xfrd_udp_obtain()
1318 xfrd->udp_waiting_first = zone; in xfrd_udp_obtain()
1319 if(xfrd->udp_waiting_last) in xfrd_udp_obtain()
1320 xfrd->udp_waiting_last->udp_waiting_next = zone; in xfrd_udp_obtain()
1321 xfrd->udp_waiting_last = zone; in xfrd_udp_obtain()
1328 if(!xfrd->got_time) { in xfrd_time()
1329 xfrd->current_time = time(0); in xfrd_time()
1330 xfrd->got_time = 1; in xfrd_time()
1332 return xfrd->current_time; in xfrd_time()
1394 zone->activated_next = xfrd->activated_first; in xfrd_set_refresh_now()
1395 if(xfrd->activated_first) in xfrd_set_refresh_now()
1396 xfrd->activated_first->activated_prev = zone; in xfrd_set_refresh_now()
1397 xfrd->activated_first = zone; in xfrd_set_refresh_now()
1435 if(event_base_set(xfrd->event_base, &zone->zone_handler) != 0) in xfrd_set_timer()
1490 xfrd->write_zonefile_needed = 1; in xfrd_handle_incoming_soa()
1537 xfrd_send_notify(xfrd->notify_zones, zone->apex, &zone->soa_nsd); in xfrd_handle_incoming_soa()
1560 xfrd_send_notify(xfrd->notify_zones, zone->apex, &zone->soa_nsd); in xfrd_handle_incoming_soa()
1566 task_new_expire(xfrd->nsd->task[xfrd->nsd->mytask], xfrd->last_task, in xfrd_send_expire_notification()
1603 if(xfrd->udp_use_num == XFRD_MAX_UDP) in xfrd_udp_release()
1605 while(xfrd->udp_waiting_first) { in xfrd_udp_release()
1607 xfrd_zone_type* wz = xfrd->udp_waiting_first; in xfrd_udp_release()
1610 xfrd->udp_waiting_first = wz->udp_waiting_next; in xfrd_udp_release()
1613 if(xfrd->udp_waiting_last == wz) in xfrd_udp_release()
1614 xfrd->udp_waiting_last = NULL; in xfrd_udp_release()
1626 if(event_base_set(xfrd->event_base, in xfrd_udp_release()
1643 if(xfrd->udp_use_num > 0) in xfrd_udp_release()
1644 xfrd->udp_use_num--; in xfrd_udp_release()
1664 if(!xfrd_udp_read_packet(xfrd->packet, zone->zone_handler.ev_fd, in xfrd_udp_read()
1677 switch(xfrd_handle_received_xfr_packet(zone, xfrd->packet)) { in xfrd_udp_read()
1679 xfrd_set_timer(zone, xfrd->tcp_set->tcp_timeout); in xfrd_udp_read()
1681 xfrd_tcp_obtain(xfrd->tcp_set, zone); in xfrd_udp_read()
1895 xfrd_setup_packet(xfrd->packet, TYPE_IXFR, CLASS_IN, zone->apex, in xfrd_send_ixfr_request_udp()
1897 zone->query_id = ID(xfrd->packet); in xfrd_send_ixfr_request_udp()
1900 NSCOUNT_SET(xfrd->packet, 1); in xfrd_send_ixfr_request_udp()
1901 xfrd_write_soa_buffer(xfrd->packet, zone->apex, &zone->soa_disk); in xfrd_send_ixfr_request_udp()
1905 xfrd->packet, &zone->latest_xfr->tsig, zone->master); in xfrd_send_ixfr_request_udp()
1907 buffer_flip(xfrd->packet); in xfrd_send_ixfr_request_udp()
1910 if((fd = xfrd_send_udp(zone->master, xfrd->packet, in xfrd_send_ixfr_request_udp()
2374 tsig_delete_record(&xfr->tsig, xfrd->region); in xfrd_free_zone_xfr()
2375 region_recycle(xfrd->region, xfr, sizeof(*xfr)); in xfrd_free_zone_xfr()
2382 xfrd_unlink_xfrfile(xfrd->nsd, xfr->xfrfilenumber); in xfrd_delete_zone_xfr()
2397 xfr = region_alloc_zero(xfrd->region, sizeof(*xfr)); in xfrd_prepare_zone_xfr()
2436 xfrd_unlink_xfrfile(xfrd->nsd, zone->latest_xfr->xfrfilenumber); in xfrd_handle_received_xfr_packet()
2462 zone->latest_xfr->xfrfilenumber = xfrd->xfrfilenumber++; in xfrd_handle_received_xfr_packet()
2468 buffer_begin(packet), buffer_limit(packet), xfrd->nsd, in xfrd_handle_received_xfr_packet()
2477 xfrd->nsd, zone->latest_xfr->xfrfilenumber); in xfrd_handle_received_xfr_packet()
2502 (char*)buffer_begin(packet), xfrd->nsd, zone->latest_xfr->xfrfilenumber); in xfrd_handle_received_xfr_packet()
2506 if(xfrd->can_send_reload && in xfrd_handle_received_xfr_packet()
2508 xfrd->nsd->task[xfrd->nsd->mytask], in xfrd_handle_received_xfr_packet()
2509 xfrd->last_task, in xfrd_handle_received_xfr_packet()
2515 zone->latest_xfr->sent = xfrd->nsd->mytask + 1; in xfrd_handle_received_xfr_packet()
2561 if(xfrd->nsd->options->xfrd_reload_timeout == -1) in xfrd_set_reload_timeout()
2563 if(xfrd->reload_timeout.tv_sec == 0 || in xfrd_set_reload_timeout()
2564 xfrd_time() >= (time_t)xfrd->reload_timeout.tv_sec ) { in xfrd_set_reload_timeout()
2566 xfrd_set_reload_now(xfrd); in xfrd_set_reload_timeout()
2568 xfrd->reload_timeout.tv_sec = xfrd_time() + in xfrd_set_reload_timeout()
2569 xfrd->nsd->options->xfrd_reload_timeout; in xfrd_set_reload_timeout()
2570 xfrd->reload_timeout.tv_usec = 0; in xfrd_set_reload_timeout()
2574 if(xfrd->reload_added == 0) { in xfrd_set_reload_timeout()
2576 tv.tv_sec = xfrd->reload_timeout.tv_sec - xfrd_time(); in xfrd_set_reload_timeout()
2578 if(tv.tv_sec > xfrd->nsd->options->xfrd_reload_timeout) in xfrd_set_reload_timeout()
2579 tv.tv_sec = xfrd->nsd->options->xfrd_reload_timeout; in xfrd_set_reload_timeout()
2580 memset(&xfrd->reload_handler, 0, sizeof(xfrd->reload_handler)); in xfrd_set_reload_timeout()
2581 event_set(&xfrd->reload_handler, -1, EV_TIMEOUT, in xfrd_set_reload_timeout()
2582 xfrd_handle_reload, xfrd); in xfrd_set_reload_timeout()
2583 if(event_base_set(xfrd->event_base, &xfrd->reload_handler) != 0) in xfrd_set_reload_timeout()
2585 if(event_add(&xfrd->reload_handler, &tv) != 0) in xfrd_set_reload_timeout()
2587 xfrd->reload_added = 1; in xfrd_set_reload_timeout()
2598 xfrd->reload_added = 0; in xfrd_handle_reload()
2599 xfrd->reload_timeout.tv_sec = xfrd_time() + in xfrd_handle_reload()
2600 xfrd->nsd->options->xfrd_reload_timeout; in xfrd_handle_reload()
2601 xfrd_set_reload_now(xfrd); in xfrd_handle_reload()
2641 zone = (xfrd_zone_type*)rbtree_search(xfrd->zones, dname); in xfrd_handle_passed_packet()
2739 uint8_t sent = (xfrd->nsd->mytask == 0) + 1; in xfrd_check_failed_updates()
2740 RBTREE_FOR(zone, xfrd_zone_type*, xfrd->zones) in xfrd_check_failed_updates()
2806 RBTREE_FOR(zone, xfrd_zone_type*, xfrd->zones) in xfrd_prepare_zones_for_reload()
2818 if(xfrd->reload_cmd_first_sent && !xfr->sent) in xfrd_prepare_zones_for_reload()
2820 assert(!xfrd->reload_cmd_first_sent || in xfrd_prepare_zones_for_reload()
2821 xfrd->reload_cmd_first_sent >= xfr->acquired); in xfrd_prepare_zones_for_reload()
2824 xfrd->nsd->task[xfrd->nsd->mytask], in xfrd_prepare_zones_for_reload()
2825 xfrd->last_task, in xfrd_prepare_zones_for_reload()
2835 xfr->sent = send ? 1 + xfrd->nsd->mytask : 0; in xfrd_prepare_zones_for_reload()
2844 return xfrd->packet; in xfrd_get_temp_buffer()
2850 xfrd_process_zonestat_inc_task(xfrd_state_type* xfrd, struct task_list_d* task) in xfrd_process_zonestat_inc_task() argument
2852 xfrd->zonestat_safe = (unsigned)task->oldserial; in xfrd_process_zonestat_inc_task()
2853 zonestat_remap(xfrd->nsd, 0, xfrd->zonestat_safe*sizeof(struct nsdst)); in xfrd_process_zonestat_inc_task()
2854 xfrd->nsd->zonestatsize[0] = xfrd->zonestat_safe; in xfrd_process_zonestat_inc_task()
2855 zonestat_remap(xfrd->nsd, 1, xfrd->zonestat_safe*sizeof(struct nsdst)); in xfrd_process_zonestat_inc_task()
2856 xfrd->nsd->zonestatsize[1] = xfrd->zonestat_safe; in xfrd_process_zonestat_inc_task()
2861 xfrd_handle_taskresult(xfrd_state_type* xfrd, struct task_list_d* task) in xfrd_handle_taskresult() argument
2864 (void)xfrd; in xfrd_handle_taskresult()
2872 xfrd_process_zonestat_inc_task(xfrd, task); in xfrd_handle_taskresult()
2881 void xfrd_process_task_result(xfrd_state_type* xfrd, struct udb_base* taskudb) in xfrd_process_task_result() argument
2889 xfrd_handle_taskresult(xfrd, TASKLIST(&t)); in xfrd_process_task_result()
2902 void xfrd_set_reload_now(xfrd_state_type* xfrd) in xfrd_set_reload_now() argument
2907 xfrd->need_to_send_reload = 1; in xfrd_set_reload_now()
2908 if(!(xfrd->ipc_handler_flags&EV_WRITE)) { in xfrd_set_reload_now()
2909 ipc_xfrd_set_listening(xfrd, EV_PERSIST|EV_READ|EV_WRITE); in xfrd_set_reload_now()
2919 if(xfrd->nsd->options->zonefiles_write == 0) in xfrd_handle_write_timer()
2922 if(!xfrd->write_zonefile_needed) { in xfrd_handle_write_timer()
2928 task_new_write_zonefiles(xfrd->nsd->task[xfrd->nsd->mytask], in xfrd_handle_write_timer()
2929 xfrd->last_task, NULL); in xfrd_handle_write_timer()
2930 xfrd_set_reload_now(xfrd); in xfrd_handle_write_timer()
2931 xfrd->write_zonefile_needed = 0; in xfrd_handle_write_timer()
2938 if(xfrd->nsd->options->zonefiles_write == 0) in xfrd_write_timer_set()
2940 tv.tv_sec = xfrd->nsd->options->zonefiles_write; in xfrd_write_timer_set()
2942 memset(&xfrd->write_timer, 0, sizeof(xfrd->write_timer)); in xfrd_write_timer_set()
2943 event_set(&xfrd->write_timer, -1, EV_TIMEOUT, in xfrd_write_timer_set()
2944 xfrd_handle_write_timer, xfrd); in xfrd_write_timer_set()
2945 if(event_base_set(xfrd->event_base, &xfrd->write_timer) != 0) in xfrd_write_timer_set()
2947 if(event_add(&xfrd->write_timer, &tv) != 0) in xfrd_write_timer_set()
2958 xfrd->child_timer_added = 0; in xfrd_handle_child_timer()