[Freeswitch-svn] [commit] r11857 - in freeswitch/trunk/libs/sofia-sip: . libsofia-sip-ua-glib/su-glib

FreeSWITCH SVN mikej at freeswitch.org
Wed Feb 11 09:19:25 PST 2009


Author: mikej
Date: Wed Feb 11 11:19:25 2009
New Revision: 11857

Log:
Wed Jan 28 12:20:34 CST 2009  Mikhail Zabaluev <mikhail.zabaluev at nokia.com>
  * Added deferrable timer support to the GSource integration.
  


Modified:
   freeswitch/trunk/libs/sofia-sip/.update
   freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua-glib/su-glib/su_source.c

Modified: freeswitch/trunk/libs/sofia-sip/.update
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/.update	(original)
+++ freeswitch/trunk/libs/sofia-sip/.update	Wed Feb 11 11:19:25 2009
@@ -1 +1 @@
-Wed Feb 11 11:18:53 CST 2009
+Wed Feb 11 11:19:18 CST 2009

Modified: freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua-glib/su-glib/su_source.c
==============================================================================
--- freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua-glib/su-glib/su_source.c	(original)
+++ freeswitch/trunk/libs/sofia-sip/libsofia-sip-ua-glib/su-glib/su_source.c	Wed Feb 11 11:19:25 2009
@@ -377,6 +377,7 @@
 {
   SuSource *ss = (SuSource *)gs;
   su_port_t *self = ss->ss_port;
+  su_duration_t tout = SU_WAIT_FOREVER;
 
   enter;
 
@@ -388,21 +389,22 @@
   if (self->sup_base->sup_timers) {
     su_time_t now;
     GTimeVal  gtimeval;
-    su_duration_t tout;
 
     g_source_get_current_time(gs, &gtimeval);
     now.tv_sec = gtimeval.tv_sec + 2208988800UL;
     now.tv_usec = gtimeval.tv_usec;
 
     tout = su_timer_next_expires(&self->sup_base->sup_timers, now);
-
-    *return_tout = (tout < 0 || tout > (su_duration_t)G_MAXINT)?
-	-1 : (gint)tout;
-
-    return (tout == 0);
   }
+  if (self->sup_base->sup_deferrable) {
+    if (tout > self->sup_base->sup_max_defer)
+      tout = self->sup_base->sup_max_defer;
+  }
+
+  *return_tout = (tout >= 0 && tout <= (su_duration_t)G_MAXINT)?
+      (gint)tout : -1;
 
-  return FALSE;
+  return (tout == 0);
 }
 
 static
@@ -440,11 +442,10 @@
   if (self->sup_base->sup_head)
     su_base_port_getmsgs(self);
 
-  if (self->sup_base->sup_timers) {
+  if (self->sup_base->sup_timers || self->sup_base->sup_deferrable) {
     su_time_t now;
     GTimeVal  gtimeval;
     su_duration_t tout;
-    int timers = 0;
 
     tout = SU_DURATION_MAX;
 
@@ -453,7 +454,8 @@
     now.tv_sec = gtimeval.tv_sec + 2208988800UL;
     now.tv_usec = gtimeval.tv_usec;
 
-    timers = su_timer_expire(&self->sup_base->sup_timers, &tout, now);
+    su_timer_expire(&self->sup_base->sup_timers, &tout, now);
+    su_timer_expire(&self->sup_base->sup_deferrable, &tout, now);
   }
 
 #if SU_HAVE_POLL



More information about the Freeswitch-svn mailing list