{
int i;
- PARA_DEBUG_LOG("supported audio formats: %s\n",
+ PARA_INFO_LOG("supported audio formats: %s\n",
SUPPORTED_AUDIO_FORMATS);
FOR_EACH_AUDIO_FORMAT(i) {
PARA_NOTICE_LOG("initializing %s handler\n",
/* Sum of the length of all control messages in the buffer */
msg.msg_controllen = cmsg->cmsg_len;
- PARA_NOTICE_LOG("passing %zu bytes and fd %d\n", size, fd);
+ PARA_DEBUG_LOG("passing %zu bytes and fd %d\n", size, fd);
ret = sendmsg(server_socket, &msg, 0);
if (ret < 0) {
ret = -ERRNO_TO_PARA_ERROR(errno);
int ret, shmid;
char buf[8];
- PARA_NOTICE_LOG("getting next af\n");
+ PARA_NOTICE_LOG("getting next audio file\n");
ret = score_get_best(&aft_row, &afd.score);
if (ret < 0)
return ret;
if (ret < 0)
return ret;
shmid = ret;
- PARA_NOTICE_LOG("shmid: %u\n", shmid);
if (!write_ok(server_socket)) {
PARA_EMERG_LOG("afs_socket not writable\n");
goto destroy;
int i, ret;
get_database_dir();
+ PARA_NOTICE_LOG("opening %u osl tables in %s\n", NUM_AFS_TABLES,
+ database_dir);
for (i = 0; i < NUM_AFS_TABLES; i++) {
ret = afs_tables[i].open(database_dir);
if (ret >= 0)
return;
}
buf[ret] = '\0';
- PARA_NOTICE_LOG("received: %s\n", buf);
+ PARA_DEBUG_LOG("received: %s\n", buf);
if (!strcmp(buf, "new")) {
ret = open_next_audio_file();
if (ret < 0)
{
int i;
- PARA_NOTICE_LOG("%lu chunks\n", afhi->chunks_total);
+ PARA_DEBUG_LOG("%lu chunks\n", afhi->chunks_total);
for (i = 0; i <= afhi->chunks_total; i++)
write_u32(buf + 4 * i, afhi->chunk_table[i]);
}
size_t size = sizeof(*afd)
+ 4 * (afd->afhi.chunks_total + 1);
- PARA_NOTICE_LOG("size: %zu\n", size);
+ PARA_DEBUG_LOG("size: %zu\n", size);
int shmid, ret = shm_new(size);
void *shm_afd;
char *buf;
get_attribute_text(&afsi->attributes, " ", &att_text);
if (!att_text)
return para_strdup(att_bitmap);
- att_lines = make_message("attributes: %s\nattributes_txt: %s",
+ att_lines = make_message("%s\nattributes_txt: %s",
att_bitmap, att_text);
free(att_text);
return att_lines;
destroy_mood(mlpd.m);
return ret;
}
- PARA_INFO_LOG("loaded mood %s\n", mlpd.m->name);
*m = mlpd.m;
return 1;
}
PARA_NOTICE_LOG("no admissible files\n");
return;
}
- PARA_NOTICE_LOG("last_played mean: %lli, last_played sigma: %llu\n",
+ PARA_INFO_LOG("last_played mean: %lli, last_played sigma: %llu\n",
(long long int)(statistics.last_played_sum / n),
(long long unsigned)int_sqrt(statistics.last_played_qd / n));
- PARA_NOTICE_LOG("num_played mean: %lli, num_played sigma: %llu\n",
+ PARA_INFO_LOG("num_played mean: %lli, num_played sigma: %llu\n",
(long long int)statistics.num_played_sum / n,
(long long unsigned)int_sqrt(statistics.num_played_qd / n));
}
current_mood = alloc_new_mood("dummy");
}
aa.m = current_mood;
- PARA_NOTICE_LOG("loaded mood %s\n", current_mood->name);
- PARA_INFO_LOG("%s\n", "computing statistics of admissible files");
+ PARA_NOTICE_LOG("computing statistics of admissible files\n");
ret = audio_file_loop(&aa, add_if_admissible);
if (ret < 0)
return ret;
log_statistics();
- PARA_NOTICE_LOG("%d admissible files \n", statistics.num);
+ PARA_INFO_LOG("%d admissible files \n", statistics.num);
for (i = 0; i < statistics.num; i++) {
struct admissible_file_info *a = aa.array + i;
ret = add_to_score_table(a->aft_row, a->score);
if (ret < 0)
goto out;
}
- PARA_NOTICE_LOG("score add complete\n");
+ PARA_NOTICE_LOG("loaded mood %s\n", current_mood->name);
ret = statistics.num;
out:
free(aa.array);
}
-static unsigned do_inits(int argc, char **argv)
+static unsigned server_init(int argc, char **argv)
{
/* connector's address information */
int sockfd;
/* become daemon */
if (conf.daemon_given)
daemon_init();
- PARA_NOTICE_LOG("%s", "initializing virtual streaming system\n");
+ PARA_NOTICE_LOG("initializing audio format handlers\n");
afh_init();
+ PARA_NOTICE_LOG("initializing virtual streaming system\n");
vss_init();
mmd->server_pid = getpid();
setup_signal_handling();
+ PARA_NOTICE_LOG("initializing the audio file selector\n");
init_afs();
mmd_lock();
/* init network socket */
- PARA_NOTICE_LOG("%s", "initializing tcp command socket\n");
+ PARA_NOTICE_LOG("initializing tcp command socket\n");
sockfd = init_network();
- PARA_NOTICE_LOG("%s", "init complete\n");
+ PARA_NOTICE_LOG("server init complete\n");
return sockfd;
}
struct timeval *timeout;
valid_fd_012();
- sockfd = do_inits(argc, argv);
+ sockfd = server_init(argc, argv);
repeat:
FD_ZERO(&rfds);
FD_ZERO(&wfds);
int i;
char *tmp;
- PARA_NOTICE_LOG("EOF\n");
if (!map) {
for (i = 0; senders[i].name; i++)
senders[i].shutdown_clients();
struct stat statbuf;
struct timeval now;
- PARA_NOTICE_LOG("recv\n");
ret = recv_afs_msg(&passed_fd, &afs_code, &afs_data);
if (ret < 0)
goto err;
- PARA_NOTICE_LOG("got the fd: %d, code: %u, shmid: %u\n",
+ PARA_DEBUG_LOG("got the fd: %d, code: %u, shmid: %u\n",
passed_fd, afs_code, afs_data);
ret = -E_BAD_AFS_CODE;
if (afs_code != NEXT_AUDIO_FILE)
recv_afs_result();
if (afsss != AFS_SOCKET_CHECK_FOR_WRITE || !FD_ISSET(afs_socket, wfds))
return;
- PARA_NOTICE_LOG("requesting new socket\n");
+ PARA_NOTICE_LOG("requesting new fd from afs\n");
ret = send_buffer(afs_socket, "new");
afsss = AFS_SOCKET_AFD_PENDING;
}