X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=command.c;h=3932ed2215691ea12fbbf04b7c7de9884c4cce4b;hp=1f9dd857e689530cc6e7ee6fa1c125aee73b8031;hb=faccd246cf9ee662cd8262d0db2a2375c1d4da86;hpb=d79c420304e9ae7e0dec89ca2644f2e04a7134e2 diff --git a/command.c b/command.c index 1f9dd857..3932ed22 100644 --- a/command.c +++ b/command.c @@ -61,17 +61,20 @@ static void mmd_dup(struct misc_meta_data *new_mmd) } /* - * compute human readable string containing - * vss status for given integer value + * Compute human readable string containing vss status for given integer value. + * + * We don't want to use vss_playing() and friends here because we take a + * snapshot of the mmd struct and use the copy for computing the state of the + * vss. If the real data were used, we would take the mmd lock for a rather + * long time or risk to get an inconsistent view. */ static char *vss_status_tohuman(unsigned int flags) { if (flags & VSS_PLAYING) return para_strdup("playing"); - else if (flags & VSS_NEXT) + if (flags & VSS_NEXT) return para_strdup("stopped"); - else - return para_strdup("paused"); + return para_strdup("paused"); } /* @@ -177,12 +180,8 @@ static int check_sender_args(int argc, char * const * argv, struct sender_comman if (!subcmds[i]) return -E_COMMAND_SYNTAX; scd->cmd_num = i; - mutex_lock(mmd_mutex); - if (!senders[scd->sender_num].client_cmds[scd->cmd_num]) { - mutex_unlock(mmd_mutex); + if (!senders[scd->sender_num].client_cmds[scd->cmd_num]) return -E_SENDER_CMD; - } - mutex_unlock(mmd_mutex); switch (scd->cmd_num) { case SENDER_ON: case SENDER_OFF: @@ -281,7 +280,8 @@ int com_si(int fd, int argc, __a_unused char * const * argv) } ut = uptime_str(); ret = send_va_buffer(fd, "up: %s\nplayed: %u\n" - "pid: %d\n" + "server_pid: %d\n" + "afs_pid: %d\n" "connections (active/accepted/total): %u/%u/%u\n" "current loglevel: %i\n" "supported audio formats: %s\n" @@ -289,6 +289,7 @@ int com_si(int fd, int argc, __a_unused char * const * argv) "%s", ut, mmd->num_played, (int)getppid(), + (int)mmd->afs_pid, mmd->active_connections, mmd->num_commands, mmd->num_connects,