Skip to content

Commit

Permalink
dialog: run loaded callbacks after dialog mod_init()
Browse files Browse the repository at this point in the history
(cherry picked from commit ea5e7f1)
  • Loading branch information
razvancrainea committed Jul 18, 2014
1 parent 465437a commit c585517
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
6 changes: 1 addition & 5 deletions modules/dialog/dialog.c
Expand Up @@ -827,11 +827,7 @@ static int mod_init(void)
run_load_callbacks();
}

/* if profiles should be kept in cachedb's */

/* do not destroy callbacks - will need them later for syncing new dialogs
destroy_dlg_callbacks( DLGCB_LOADED );
*/
mark_dlg_loaded_callbacks_run();
destroy_cachedb(0);

return 0;
Expand Down
9 changes: 7 additions & 2 deletions modules/dialog/dlg_cb.c
Expand Up @@ -38,6 +38,7 @@

static struct dlg_head_cbl* create_cbs = 0;

static int dlg_load_cbs_run = 0;
static struct dlg_head_cbl* load_cbs = 0;

static struct dlg_cb_params params = {NULL, DLG_DIR_NONE, NULL, NULL};
Expand Down Expand Up @@ -81,6 +82,11 @@ void destroy_dlg_callbacks_list(struct dlg_callback *cb)
}
}

void mark_dlg_loaded_callbacks_run(void)
{
dlg_load_cbs_run = 1;
}


void destroy_dlg_callbacks(unsigned int types)
{
Expand Down Expand Up @@ -151,10 +157,9 @@ int register_dlgcb(struct dlg_cell *dlg, int types, dialog_cb f,
create_cbs->first = cb;
create_cbs->types |= types;
} else if (types==DLGCB_LOADED) {
if (load_cbs==POINTER_CLOSED_MARKER) {
if (dlg_load_cbs_run) {
/* run the callback on the spot */
run_load_callback(cb);
destroy_dlg_callbacks_list(cb);
return 0;
}
if (load_cbs==0) {
Expand Down
2 changes: 2 additions & 0 deletions modules/dialog/dlg_cb.h
Expand Up @@ -86,6 +86,8 @@ void destroy_dlg_callbacks(unsigned int type);

void destroy_dlg_callbacks_list(struct dlg_callback *cb);

void mark_dlg_loaded_callbacks_run(void);

int register_dlgcb( struct dlg_cell* dlg, int types, dialog_cb f, void *param, param_free_cb ff);

void run_create_callbacks(struct dlg_cell *dlg, struct sip_msg *msg);
Expand Down

0 comments on commit c585517

Please sign in to comment.