Commit f2076cb1 authored by Simon Morlat's avatar Simon Morlat

fix issue #3620 (lost registration forever) occuring when multiple...

fix issue #3620 (lost registration forever) occuring when multiple transactions notify a same channel about a timeout.
parent 4b1cc438
......@@ -731,7 +731,7 @@ belle_sip_list_t *belle_sip_parse_directory(const char *path, const char *file_t
}
/* loop on all directory files */
errno = 0;
errno = 0;
ent = readdir(dir);
while (ent != NULL) {
/* filter on file type if given */
......
......@@ -1012,6 +1012,12 @@ static void belle_sip_channel_handle_error(belle_sip_channel_t *obj){
int belle_sip_channel_notify_timeout(belle_sip_channel_t *obj){
const int too_long=60;
if (obj->state != BELLE_SIP_CHANNEL_READY){
/*no need to notify the timeout if the channel is already in error or retry state*/
return FALSE;
}
if ((int)(belle_sip_time_ms() - obj->last_recv_time) >= (too_long * 1000)){
belle_sip_message("A timeout related to this channel occured and no message received during last %i seconds. This channel is suspect, moving to error state",too_long);
channel_set_state(obj,BELLE_SIP_CHANNEL_ERROR);
......
......@@ -277,7 +277,7 @@ void belle_sip_transaction_notify_timeout(belle_sip_transaction_t *t){
belle_sip_object_ref(t); /*take a ref in the case where the app calls belle_sip_transaction_terminate() within the timeout listener*/
if (strcmp(belle_sip_request_get_method(t->request),"REGISTER")==0){
if ( belle_sip_channel_notify_timeout(t->channel)==TRUE){
belle_sip_warning("Transaction [%p] reporting timeout, reporting to channel.",t);
belle_sip_warning("Transaction [%p] has timeout, reported to channel.",t);
t->timed_out=TRUE;
}
}else {
......
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