/** * Handle notify. * */ static void notify_handle_zone(netio_type* ATTR_UNUSED(netio), netio_handler_type* handler, netio_events_type event_types) { notify_type* notify = NULL; xfrhandler_type* xfrhandler = NULL; zone_type* zone = NULL; if (!handler) { return; } notify = (notify_type*) handler->user_data; ods_log_assert(notify); xfrhandler = (xfrhandler_type*) notify->xfrhandler; zone = (zone_type*) notify->zone; ods_log_assert(xfrhandler); ods_log_assert(zone); ods_log_assert(zone->name); ods_log_debug("[%s] handle notify for zone %s", notify_str, zone->name); if (notify->is_waiting) { ods_log_debug("[%s] already waiting, skipping notify for zone %s", notify_str, zone->name); ods_log_assert(notify->handler.fd == -1); return; } if (event_types & NETIO_EVENT_READ) { ods_log_debug("[%s] read notify ok for zone %s", notify_str, zone->name); ods_log_assert(notify->handler.fd != -1); if (notify_udp_read_packet(notify)) { if (notify_handle_reply(notify)) { notify_next(notify); } } } else if(event_types & NETIO_EVENT_TIMEOUT) { ods_log_debug("[%s] notify timeout for zone %s", notify_str, zone->name); /* timeout, try again */ } /* see if notify is still enabled */ if (notify->secondary) { ods_log_assert(notify->secondary->address); notify->retry++; if (notify->retry > NOTIFY_MAX_RETRY) { ods_log_verbose("[%s] notify max retry for zone %s, %s unreachable", notify_str, zone->name, notify->secondary->address); notify_next(notify); } else { notify_send(notify); } } return; }
void cmpi_client_code() { wait_for_notification(); notify_next(); NOTE("PROCEEDING..."); cmpi_driver* driver = driver_create(); while (! driver->quitting) { driver_setup_fifo(driver); driver_process(driver); } NOTE("QUITTING"); }