]> git.tuebingen.mpg.de Git - paraslash.git/blobdiff - server.c
mmd: rename dbt_num to selector_num
[paraslash.git] / server.c
index 3f5570dd227621eec47a07394e87de1c7ebe9dad..59bc7935645a59907a17f1172500a7f19e38818e 100644 (file)
--- a/server.c
+++ b/server.c
@@ -69,8 +69,8 @@ struct audio_file_selector dblist[] = {
                .update_audio_file = NULL,
        },
        {
-               .name = "plm",
-               .init = plm_selector_init,
+               .name = "playlist",
+               .init = playlist_selector_init,
                .update_audio_file = NULL,
                .pre_select = NULL,
                .post_select = NULL,
@@ -174,7 +174,7 @@ static void shm_init(void)
                goto err_out;
        mmd_mutex = ret;
 
-       mmd->dbt_num = 0;
+       mmd->selector_num = 0;
        mmd->num_played = 0;
        mmd->num_commands = 0;
        mmd->events = 0;
@@ -294,12 +294,12 @@ static void init_selector(void)
                        PARA_WARNING_LOG("%s", PARA_STRERROR(-ret));
                        break;
                }
-               mmd->dbt_num = i;
+               mmd->selector_num = i;
                return;
        }
        PARA_WARNING_LOG("%s", "falling back to the random selector\n");
 random:
-       mmd->dbt_num = 0;
+       mmd->selector_num = 0;
        dblist[0].init(&dblist[0]); /* always successful */
 }
 
@@ -372,19 +372,19 @@ static unsigned do_inits(int argc, char **argv)
 
 static void handle_dbt_change(void)
 {
-       int ret, old = mmd->dbt_num, new = mmd->dbt_change;
+       int ret, old = mmd->selector_num, new = mmd->dbt_change;
 
        dblist[old].shutdown();
        ret = dblist[new].init(&dblist[new]);
        mmd->dbt_change = -1; /* reset */
        if (ret >= 0) {
-               mmd->dbt_num = new;
+               mmd->selector_num = new;
                return;
        }
        /* init failed */
        PARA_ERROR_LOG("%s -- switching to the random selector\n", PARA_STRERROR(-ret));
        dblist[0].init(&dblist[0]);
-       mmd->dbt_num = 0;
+       mmd->selector_num = 0;
 }
 
 /*
@@ -396,7 +396,7 @@ static void handle_sighup(void)
        close_log(logfile); /* gets reopened if necessary by parse_config */
        logfile = NULL;
        parse_config(1); /* reopens log */
-       mmd->dbt_change = mmd->dbt_num; /* do not change selector */
+       mmd->dbt_change = mmd->selector_num; /* do not change selector */
        handle_dbt_change(); /* reload selector */
 }
 
@@ -459,8 +459,8 @@ repeat:
                        &max_fileno,
                        &rfds, &wfds);
        }
-       if (dblist[mmd->dbt_num].pre_select) {
-               ret = dblist[mmd->dbt_num].pre_select(&rfds, &wfds);
+       if (dblist[mmd->selector_num].pre_select) {
+               ret = dblist[mmd->selector_num].pre_select(&rfds, &wfds);
                max_fileno = MAX(max_fileno, ret);
        }
        mmd_unlock();
@@ -471,8 +471,8 @@ repeat:
        mmd_lock();
        if (mmd->dbt_change >= 0)
                handle_dbt_change();
-       if (dblist[mmd->dbt_num].post_select)
-               dblist[mmd->dbt_num].post_select(&rfds, &wfds);
+       if (dblist[mmd->selector_num].post_select)
+               dblist[mmd->selector_num].post_select(&rfds, &wfds);
        if (ret < 0 && err == EINTR)
                goto repeat;
        if (ret < 0) {
@@ -507,7 +507,7 @@ repeat:
                case SIGTERM:
                        PARA_EMERG_LOG("terminating on signal %d\n", sig);
                        kill(0, SIGTERM);
-                       dblist[mmd->dbt_num].shutdown();
+                       dblist[mmd->selector_num].shutdown();
                        mutex_destroy(mmd_mutex);
                        shm_detach(mmd);
                        shm_destroy(mmd_shm_id);