From eda19ad695860d6b1d8d161ef96063182bdde060 Mon Sep 17 00:00:00 2001 From: Stefan Becker Date: Wed, 4 Dec 2013 14:23:05 +0200 Subject: [PATCH] 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. --- src/core/sipe-groupchat.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) 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); - } } } -- 2.11.4.GIT