mesh_serve_expired_init(struct mesh_state* mstate, int timeout)
{
	struct timeval t;

	/* Create serve_expired_data if not there yet */
	if(!mstate->s.serve_expired_data) {
		mstate->s.serve_expired_data = (struct serve_expired_data*)
			regional_alloc_zero(
				mstate->s.region, sizeof(struct serve_expired_data));
		if(!mstate->s.serve_expired_data)
			return 0;
	}

	/* Don't overwrite the function if already set */
	mstate->s.serve_expired_data->get_cached_answer =
		mstate->s.serve_expired_data->get_cached_answer?
		mstate->s.serve_expired_data->get_cached_answer:
		&mesh_serve_expired_lookup;

	/* In case this timer already popped, start it again */
	if(!mstate->s.serve_expired_data->timer) {
		mstate->s.serve_expired_data->timer = comm_timer_create(
			mstate->s.env->worker_base, mesh_serve_expired_callback, mstate);
		if(!mstate->s.serve_expired_data->timer)
			return 0;
#ifndef S_SPLINT_S
		t.tv_sec = timeout/1000;
		t.tv_usec = (timeout%1000)*1000;
#endif
		comm_timer_set(mstate->s.serve_expired_data->timer, &t);
	}
	return 1;
}
mesh_serve_expired_init(struct mesh_state* mstate, int timeout)
{
	struct timeval t;

	 
	if(!mstate->s.serve_expired_data) {
		mstate->s.serve_expired_data = (struct serve_expired_data*)
			regional_alloc_zero(
				mstate->s.region, sizeof(struct serve_expired_data));
		if(!mstate->s.serve_expired_data)
			return 0;
	}

	 
	mstate->s.serve_expired_data->get_cached_answer =
		mstate->s.serve_expired_data->get_cached_answer?
		mstate->s.serve_expired_data->get_cached_answer:
		&mesh_serve_expired_lookup;

	 
	if(!mstate->s.serve_expired_data->timer) {
		mstate->s.serve_expired_data->timer = comm_timer_create(
			mstate->s.env->worker_base, mesh_serve_expired_callback, mstate);
		if(!mstate->s.serve_expired_data->timer)
			return 0;
#ifndef S_SPLINT_S
		t.tv_sec = timeout/1000;
		t.tv_usec = (timeout%1000)*1000;
#endif
		comm_timer_set(mstate->s.serve_expired_data->timer, &t);
	}
	return 1;
}