Example #1
0
static void wait_replies(struct messaging_context *msg_ctx,
			 bool multiple_replies)
{
	struct tevent_timer *te;
	bool timed_out = False;

	if (!(te = tevent_add_timer(messaging_event_context(msg_ctx), NULL,
				    timeval_current_ofs(timeout, 0),
				    smbcontrol_timeout, (void *)&timed_out))) {
		DEBUG(0, ("tevent_add_timer failed\n"));
		return;
	}

	while (!timed_out) {
		int ret;
		if (num_replies > 0 && !multiple_replies)
			break;
		ret = tevent_loop_once(messaging_event_context(msg_ctx));
		if (ret != 0) {
			break;
		}
	}
}
Example #2
0
static bool print_queue_housekeeping(const struct timeval *now, void *pvt)
{
	struct messaging_context *msg_ctx =
		talloc_get_type_abort(pvt, struct messaging_context);
	time_t printcap_cache_time = (time_t)lp_printcap_cache_time();
	time_t t = time_mono(NULL);

	DEBUG(5, ("print queue housekeeping\n"));

	/* if periodic printcap rescan is enabled,
	 * see if it's time to reload */
	if ((printcap_cache_time != 0) &&
	    (t >= (last_printer_reload_time + printcap_cache_time))) {
		DEBUG( 3,( "Printcap cache time expired.\n"));
		pcap_cache_reload(messaging_event_context(msg_ctx),
				  msg_ctx,
				  &reload_pcap_change_notify);
		last_printer_reload_time = t;
	}

	return true;
}