Commit 88897615 authored by Mikhail Zabaluev's avatar Mikhail Zabaluev

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

Re-recorded 20090119150441-5b6ca-c20da738844361925e89f91a836ecfe0337ff406

darcs-hash:20090128183106-5b6ca-cbb380e6f3e7d501d286d19cd79a49f30cc1b33f.gz
parent 36982c68
......@@ -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;
if (self->sup_base->sup_deferrable) {
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)?
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment