X-Git-Url: http://git.tuebingen.mpg.de/?a=blobdiff_plain;f=afs.c;h=cc6d7467b3570228cb45f70a329da7467d007e71;hb=da0a1b59045898dd73d6737ccd4f4af6fb29ad7f;hp=0c7526c74110fb59da4cc20b815972421090cc12;hpb=d894e0cc7ce94d09847a8a35f47127968d4268f1;p=paraslash.git diff --git a/afs.c b/afs.c index 0c7526c7..cc6d7467 100644 --- a/afs.c +++ b/afs.c @@ -80,6 +80,8 @@ static struct command_task command_task_struct; static struct signal_task signal_task_struct; static enum play_mode current_play_mode; +static char *current_mop; /* mode or playlist specifier. NULL means dummy mooe */ + /** * A random number used to "authenticate" the connection. @@ -431,7 +433,7 @@ int stdin_command(int fd, struct osl_object *arg_obj, callback_function *f, return ret; } -int pass_afd(int fd, char *buf, size_t size) +static int pass_afd(int fd, char *buf, size_t size) { struct msghdr msg = {.msg_iov = NULL}; struct cmsghdr *cmsg; @@ -468,14 +470,13 @@ int pass_afd(int fd, char *buf, size_t size) /** * Open the audio file with highest score. * - * \param afd Audio file data is returned here. - * - * This stores all information for streaming the "best" audio file - * in the \a afd structure. + * This stores all information for streaming the "best" audio file in a shared + * memory area. The id of that area and an open file descriptor for the next + * audio file are passed to the server process. * - * \return Positive on success, negative on errors. + * \return Standard. * - * \sa close_audio_file(), open_and_update_audio_file(). + * \sa open_and_update_audio_file(). */ int open_next_audio_file(void) { @@ -500,6 +501,7 @@ int open_next_audio_file(void) *(uint32_t *)buf = NEXT_AUDIO_FILE; *(uint32_t *)(buf + 4) = (uint32_t)shmid; ret = pass_afd(afd.fd, buf, 8); + close(afd.fd); if (ret >= 0) return ret; PARA_ERROR_LOG("%s\n", PARA_STRERROR(-ret)); @@ -508,8 +510,6 @@ destroy: return ret; } -static char *current_mop; /* mode or playlist specifier. NULL means dummy mooe */ - /* Never fails if arg == NULL */ static int activate_mood_or_playlist(char *arg, int *num_admissible) {