From: Stefan Becker Date: Wed, 4 Dec 2013 12:23:05 +0000 (+0200) Subject: Fix #222: SIPE crashes when groupchat session expires (VI) X-Git-Tag: 1.17.3~4 X-Git-Url: https://repo.or.cz/w/siplcs.git/commitdiff_plain/2b7c757285ad03a451cf6defad27857082bc5855 Fix #222: SIPE crashes when groupchat session expires (VI) As UPDATE now supports a callback, so it makes more sense to restart the update timer in the callback. (cherry picked from commit eda19ad695860d6b1d8d161ef96063182bdde060) --- diff --git a/src/core/sipe-groupchat.c b/src/core/sipe-groupchat.c index 20e50a63..74d22e74 100644 --- a/src/core/sipe-groupchat.c +++ b/src/core/sipe-groupchat.c @@ -363,16 +363,26 @@ static gchar *generate_chanid_node(const gchar *uri, guint key) } /* TransCallback */ +static void groupchat_update_cb(struct sipe_core_private *sipe_private, + gpointer data); static gboolean groupchat_expired_session_response(struct sipe_core_private *sipe_private, struct sipmsg *msg, SIPE_UNUSED_PARAMETER struct transaction *trans) { + struct sipe_groupchat *groupchat = sipe_private->groupchat; + /* 481 Call Leg Does Not Exist -> server dropped session */ if (msg->response == 481) { - struct sipe_groupchat *groupchat = sipe_private->groupchat; groupchat->session = NULL; groupchat->connected = FALSE; sipe_groupchat_init(sipe_private); + } else { + sipe_schedule_seconds(sipe_private, + "<+groupchat-expires>", + NULL, + groupchat->expires, + groupchat_update_cb, + NULL); } return(TRUE); @@ -388,17 +398,10 @@ static void groupchat_update_cb(struct sipe_core_private *sipe_private, struct sip_dialog *dialog = sipe_dialog_find(groupchat->session, groupchat->session->with); - if (dialog) { + if (dialog) sip_transport_update(sipe_private, dialog, groupchat_expired_session_response); - sipe_schedule_seconds(sipe_private, - "<+groupchat-expires>", - NULL, - groupchat->expires, - groupchat_update_cb, - NULL); - } } }