Wed Jan 28 12:31:06 CST 2009 Mikhail Zabaluev <mikhail.zabaluev@nokia.com>

* su-glib/su_source.c: improved the deferrable timeout calculation
  


git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@11860 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2009-02-11 17:20:26 +00:00
parent 81d8e58821
commit cf1f74fbc3

View File

@ -386,7 +386,7 @@ gboolean su_source_prepare(GSource *gs, gint *return_tout)
return TRUE;
}
if (self->sup_base->sup_timers) {
if (self->sup_base->sup_timers || self->sup_base->sup_deferrable) {
su_time_t now;
GTimeVal gtimeval;
@ -395,10 +395,18 @@ gboolean su_source_prepare(GSource *gs, gint *return_tout)
now.tv_usec = gtimeval.tv_usec;
tout = su_timer_next_expires(&self->sup_base->sup_timers, now);
}
if (self->sup_base->sup_deferrable) {
if (tout > self->sup_base->sup_max_defer)
tout = self->sup_base->sup_max_defer;
su_duration_t tout_defer;
tout_defer = su_timer_next_expires(&self->sup_base->sup_deferrable, now);
if (tout_defer < self->sup_base->sup_max_defer)
tout_defer = self->sup_base->sup_max_defer;
if (tout > tout_defer)
tout = tout_defer;
}
}
*return_tout = (tout >= 0 && tout <= (su_duration_t)G_MAXINT)?