コード例 #1
0
ファイル: pdomain.c プロジェクト: OPSF/uClinux
int timer_pdomain(pdomain_t* _d)
{
	struct presentity* presentity, *t;

	lock_pdomain(_d);

	presentity = _d->first;

	if (0) LOG(L_ERR, "timer_pdomain: _d=%s d->first=%p\n", _d->name->s, presentity);
	while(presentity) {
		if (timer_presentity(presentity) < 0) {
			LOG(L_ERR, "timer_pdomain(): Error in timer_pdomain\n");
			unlock_pdomain(_d);
			return -1;
		}
		
		     /* Remove the entire record
		      * if it is empty
		      */
		if (presentity->watchers == 0 && presentity->winfo_watchers==0) {
			t = presentity;
			presentity = presentity->next;
			remove_presentity(_d, t);
			free_presentity(t);
		} else {
			presentity = presentity->next;
		}
	}
	
	unlock_pdomain(_d);
	return 0;
}
コード例 #2
0
ファイル: pdomain.c プロジェクト: 4N7HR4X/kamailio
int timer_pdomain(pdomain_t* _d)
{
	struct presentity* presentity, *t;
	time_t start, stop;

	PROF_START(pa_timer_pdomain)
	lock_pdomain(_d);
	start = time(NULL);

	presentity = _d->first;

	while(presentity) {
		if (timer_presentity(presentity) < 0) {
			LOG(L_ERR, "timer_pdomain(): Error in timer_pdomain\n");
			unlock_pdomain(_d);
			PROF_STOP(pa_timer_pdomain)
			return -1;
		}
		
		/* Remove the entire record
		 * if it is empty
		 */
		if ( (!presentity->first_watcher) && 
				(!presentity->first_winfo_watcher) && 
				(!presentity->data.first_tuple) &&
				(!presentity->data.first_note) &&
				(!presentity->data.first_unknown_element) &&
				(!presentity->first_qsa_subscription) &&
				(presentity->ref_cnt == 0)) {
			LOG(L_DBG, "timer_pdomain(): removing empty presentity\n");
			t = presentity;
			presentity = presentity->next;
			release_presentity(t);
		} else {
			presentity = presentity->next;
		}
	}