Exemple #1
0
void f_external_start (void)
{
	int fd, num_arg = st_num_arg;
	svalue_t *arg = sp - num_arg + 1;

	if (check_valid_socket("external", -1, current_object, "N/A", -1)) {
		fd = external_start(arg[0].u.number, arg + 1,
				arg + 2, arg + 3, (num_arg == 5 ? arg + 4 : 0));
		pop_n_elems(num_arg - 1);
		sp->u.number = fd;
	} else {
		pop_n_elems(num_arg - 1);
		sp->u.number = EESECURITY;
	}
}
/** \brief launch the levt timeout if needed
 * 
 * - if delay is null, dont start the timeout
 */
void	timeout_t::launch_timerext(const delay_t &delay)	throw()
{
	// sanity check - the external timer MUST NOT be started
	DBG_ASSERT( !external_is_started() );
	// log to debug
	KLOG_DBG("enter delay=" << delay);
	// if the delay is null, do notihing
	if( delay.is_null() ){
		// set the next_expire_date to null delay_t
		next_expire_date= delay_t();
		return;
	}
	// if the delay is special (aka NEVER or ALWAYS), set next_expire_date but no external_start()
	if( delay.is_infinite() ){
		next_expire_date= delay;
		return;
	}
	// if delay is NOT null or special, compute the actual date
	next_expire_date= date_t::present() + delay;
	// start the external timer
	external_start(delay);
}