Commit e9a1bdac authored by Simon Morlat's avatar Simon Morlat

implement non-catchup time behavior

parent 0c85d92d
......@@ -34,7 +34,8 @@ BELLESIP_EXPORT belle_sip_socket_t belle_sip_source_get_socket(const belle_sip_s
* Callback function prototype for main loop notifications.
* Return value is important:
* BELLE_SIP_STOP => source is removed from main loop.
* BELLE_SIP_CONTINUE => source is kept.
* BELLE_SIP_CONTINUE => source is kept, timeout is restarted if any according to last expiry time
* BELLE_SIP_CONTINUE_WITHOUT_CATCHUP => source is kept, timeout is restarted if any according to current time
**/
typedef int (*belle_sip_source_func_t)(void *user_data, unsigned int events);
......@@ -42,8 +43,9 @@ typedef void (*belle_sip_callback_t)(void *user_data);
typedef struct belle_sip_main_loop belle_sip_main_loop_t;
#define BELLE_SIP_CONTINUE TRUE
#define BELLE_SIP_STOP FALSE
#define BELLE_SIP_CONTINUE_WITHOUT_CATCHUP 2
#define BELLE_SIP_CONTINUE 1
#define BELLE_SIP_STOP 0
BELLE_SIP_BEGIN_DECLS
......
......@@ -431,7 +431,11 @@ void belle_sip_main_loop_iterate(belle_sip_main_loop_t *ml){
belle_sip_main_loop_remove_source(ml,s);
}else if (s->revents==BELLE_SIP_EVENT_TIMEOUT){
/*timeout needs to be started again */
s->expire_ms+=s->timeout;
if (ret==BELLE_SIP_CONTINUE_WITHOUT_CATCHUP){
s->expire_ms=cur+s->timeout;
}else{
s->expire_ms+=s->timeout;
}
s->expired=FALSE;
}
}else belle_sip_main_loop_remove_source(ml,s);
......
......@@ -188,7 +188,7 @@ static int keep_alive_timer_func(void *user_data, unsigned int events) {
belle_sip_channel_close(channel);
}
belle_sip_list_free(to_be_closed);
return BELLE_SIP_CONTINUE;
return BELLE_SIP_CONTINUE_WITHOUT_CATCHUP;
}
void belle_sip_listening_point_set_keep_alive(belle_sip_listening_point_t *lp,int ms) {
......
if BUILD_TESTS
noinst_PROGRAMS=belle_sip_tester belle_sip_object_describe
noinst_PROGRAMS=belle_sip_tester belle_sip_object_describe belle_sip_parse
TESTS=belle_sip_tester
belle_sip_tester_SOURCES= belle_sip_tester.c \
......@@ -23,6 +23,8 @@ belle_sip_tester_LDFLAGS=$(CUNIT_LIBS) $(AM_LDFLAGS)
belle_sip_object_describe_SOURCES=describe.c
belle_sip_parse_SOURCES=parse.c
AM_CPPFLAGS=-I$(top_srcdir)/include -I$(top_srcdir)/src
LDADD=$(top_builddir)/src/libbellesip.la
......
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