Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
idnode list mapping: fix the channel-service save on shutdown
  • Loading branch information
perexg committed Jun 16, 2015
1 parent 200ba1f commit 4d5a4eb
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 12 deletions.
6 changes: 3 additions & 3 deletions src/access.c
Expand Up @@ -995,7 +995,7 @@ access_entry_destroy(access_entry_t *ae)
void
access_destroy_by_profile(profile_t *pro, int delconf)
{
idnode_list_destroy(&pro->pro_accesses, pro);
idnode_list_destroy(&pro->pro_accesses, delconf ? pro : NULL);
}

/*
Expand All @@ -1004,7 +1004,7 @@ access_destroy_by_profile(profile_t *pro, int delconf)
void
access_destroy_by_dvr_config(dvr_config_t *cfg, int delconf)
{
idnode_list_destroy(&cfg->dvr_accesses, cfg);
idnode_list_destroy(&cfg->dvr_accesses, delconf ? cfg : NULL);
}

/*
Expand All @@ -1013,7 +1013,7 @@ access_destroy_by_dvr_config(dvr_config_t *cfg, int delconf)
void
access_destroy_by_channel_tag(channel_tag_t *ct, int delconf)
{
idnode_list_destroy(&ct->ct_accesses, ct);
idnode_list_destroy(&ct->ct_accesses, delconf ? ct : NULL);
}

/**
Expand Down
12 changes: 6 additions & 6 deletions src/channels.c
Expand Up @@ -752,7 +752,7 @@ channel_delete ( channel_t *ch, int delconf )

/* Tags */
while((ilm = LIST_FIRST(&ch->ch_ctms)) != NULL)
channel_tag_mapping_destroy(ilm, ch);
channel_tag_mapping_destroy(ilm, delconf ? ch : NULL);

/* DVR */
autorec_destroy_by_channel(ch, delconf);
Expand All @@ -761,7 +761,7 @@ channel_delete ( channel_t *ch, int delconf )

/* Services */
while((ilm = LIST_FIRST(&ch->ch_services)) != NULL)
idnode_list_unlink(ilm, ch);
idnode_list_unlink(ilm, delconf ? ch : NULL);

/* Subscriptions */
while((s = LIST_FIRST(&ch->ch_subscriptions)) != NULL) {
Expand Down Expand Up @@ -944,11 +944,11 @@ channel_tag_destroy(channel_tag_t *ct, int delconf)
{
idnode_list_mapping_t *ilm;

if (delconf) {
while((ilm = LIST_FIRST(&ct->ct_ctms)) != NULL)
channel_tag_mapping_destroy(ilm, ilm->ilm_in1);
while((ilm = LIST_FIRST(&ct->ct_ctms)) != NULL)
channel_tag_mapping_destroy(ilm, delconf ? ilm->ilm_in1 : NULL);

if (delconf)
hts_settings_remove("channel/tag/%s", idnode_uuid_as_str(&ct->ct_id));
}

if(ct->ct_enabled && !ct->ct_internal)
htsp_tag_delete(ct);
Expand Down
5 changes: 2 additions & 3 deletions src/service.c
Expand Up @@ -811,12 +811,11 @@ service_destroy(service_t *t, int delconf)

service_mapper_remove(t);

while((s = LIST_FIRST(&t->s_subscriptions)) != NULL) {
while((s = LIST_FIRST(&t->s_subscriptions)) != NULL)
subscription_unlink_service(s, SM_CODE_SOURCE_DELETED);
}

while ((ilm = LIST_FIRST(&t->s_channels)))
idnode_list_unlink(ilm, t);
idnode_list_unlink(ilm, delconf ? t : NULL);

idnode_unlink(&t->s_id);

Expand Down

0 comments on commit 4d5a4eb

Please sign in to comment.