]> git.tuebingen.mpg.de Git - paraslash.git/commitdiff
Merge /fml/ag-raetsch/home/maan/scm/paraslash/ into my-osx
authorAndre Noll <maan@congo.fml.local>
Fri, 11 Aug 2006 15:01:36 +0000 (17:01 +0200)
committerAndre Noll <maan@congo.fml.local>
Fri, 11 Aug 2006 15:01:36 +0000 (17:01 +0200)
18 files changed:
Makefile.in
NEWS
afs.c
audiod.c
audiod.h
client_common.c
command.c
crypt.c
dccp_send.c
error.h
gui.c
http_recv.c
mysql_selector.c
net.c
scripts/demo-script
versions/paraslash-0.2.13.tar.bz2 [new file with mode: 0644]
versions/paraslash-0.2.13.tar.bz2.asc [new file with mode: 0644]
web/index.in.html

index 2aece7ceb5013a5e7bdfc1af7df2540a1487ac85..80a19ea3c2edcb6341899a0e5831690f658c8103 100644 (file)
@@ -16,7 +16,7 @@ install_sh = @install_sh@
 build_date = $(shell date)
 system = $(shell uname -rs)
 cc_version = $(shell $(CC) --version | head -n 1)
-codename = oriented abstraction
+codename = transient singularity
 
 DEBUG_CPPFLAGS += -Wno-sign-compare -g -Wunused -Wundef -W
 
diff --git a/NEWS b/NEWS
index c4e087b5bb721bf2915853d81b88800eb2b08029..700871159748f79bcad48c818ba5f3465f7f6feb 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,9 +1,13 @@
 NEWS
 ====
 
--------------------------------------------
-0.?.? (to be announced) "sonic convolution"
--------------------------------------------
+------------------------------------------------
+0.?.? (to be announced) "transient singularity"
+------------------------------------------------
+
+---------------------------------------
+0.2.13 (2006-07-14) "sonic convolution"
+---------------------------------------
 
 A bunch of new features and core changes.
 
@@ -12,9 +16,8 @@ A bunch of new features and core changes.
          handler/filter (requires libfaad).
        - each writer has its own command line parser, just like
          para_recv and para_filter.
-       - new writer: osxplay (thanks to Gerd Becker)
        - para_client and para_audioc use the error subsystem
-       - writers are integrated in para_audiod
+       - writers are integrated in para_audiod (currently linux-only)
        - para_client is integrated in para_audiod
        - random/playlist selector: improved info strings
        - new audiod commands: tasks, kill
diff --git a/afs.c b/afs.c
index 49aabafb30fd7dd4e743d3fd9bfd3cab916d8a7d..b9d24331148263bfeca4ae075a989ca89eeeb3fb 100644 (file)
--- a/afs.c
+++ b/afs.c
@@ -288,14 +288,15 @@ free:
 }
 
 static int chk_barrier(const char *bname, const struct timeval *now,
-               const struct timeval *barrier, struct timeval *diff, int log)
+               const struct timeval *barrier, struct timeval *diff,
+               int print_log)
 {
        long ms;
 
        if (tv_diff(now, barrier, diff) > 0)
                return 1;
        ms = tv2ms(diff);
-       if (log && ms)
+       if (print_log && ms)
                PARA_DEBUG_LOG("%s barrier: %lims left\n", bname, ms);
        return -1;
 }
index c88facc798506c7ec567be774044780b872a500d..ed5344c076636f77e23fdf6c756f62e6a369a995 100644 (file)
--- a/audiod.c
+++ b/audiod.c
@@ -456,10 +456,12 @@ static int open_current_receiver(struct sched *s)
 {
        int i;
        struct timeval diff;
+       char *audio_format = stat_task->stat_item_values[SI_FORMAT];
 
-       if (!stat_task->af_status || !stat_task->pcd)
+       if (!audio_format || !stat_task->pcd)
                return 0;
-       i = get_audio_format_num(stat_task->af_status);
+       i = get_audio_format_num(audio_format + strlen(
+               status_item_list[SI_FORMAT]) + 1);
        if (i < 0)
                return 0;
        if (receiver_running(i))
@@ -533,10 +535,6 @@ static void check_stat_line(char *line)
        case SI_STATUS:
                stat_task->playing = strstr(line, "playing")? 1 : 0;
                break;
-       case SI_FORMAT:
-               free(stat_task->af_status);
-               stat_task->af_status = para_strdup(line + ilen + 1);
-               break;
        case SI_OFFSET:
                stat_task->offset_seconds = atoi(line + ilen + 1);
                break;
@@ -641,10 +639,6 @@ static void audiod_pre_select(struct sched *s, __a_unused struct task *t)
                if (!sl->fc || !*sl->fc->out_loaded || sl->wng)
                        continue;
                if (tv_diff(now, &initial_delay_barrier, &diff) > 0) {
-                       PARA_INFO_LOG("barrier: %lu:%lu, now: %lu, %lu\n",
-                               initial_delay_barrier.tv_sec,
-                               initial_delay_barrier.tv_usec,
-                               now->tv_sec, now->tv_usec);
                        open_writers(i);
                        s->timeout = min_delay;
                        continue;
@@ -1021,13 +1015,22 @@ static void status_pre_select(struct sched *s, struct task *t)
 static void status_post_select(__a_unused struct sched *s, struct task *t)
 {
        struct status_task *st = t->private_data;
+       unsigned bytes_left;
 
        t->ret = 1;
-       if (!st->pcd || !st->pcd->loaded
-                       || st->pcd->status != CL_RECEIVING)
+       if (!st->pcd || st->pcd->status != CL_RECEIVING)
                return;
-       st->pcd->loaded = for_each_line(st->pcd->buf, st->pcd->loaded,
+       bytes_left = for_each_line(st->pcd->buf, st->pcd->loaded,
                &check_stat_line);
+       if (st->pcd->loaded != bytes_left) {
+               st->last_status_read = *now;
+               st->pcd->loaded = bytes_left;
+       } else {
+               struct timeval diff;
+               tv_diff(now, &st->last_status_read, &diff);
+               if (diff.tv_sec > 61)
+                       close_stat_pipe();
+       }
 }
 
 static void init_status_task(struct status_task *st)
index e4faea4e9dcfbfb9c8be9af441ed550a78cc8556..077ce03e415f45c2937d953a8602193e7f6c68a1 100644 (file)
--- a/audiod.h
+++ b/audiod.h
@@ -61,6 +61,8 @@ struct status_task {
        char *stat_item_values[NUM_STAT_ITEMS];
        /** do not restart client command until this time */
        struct timeval restart_barrier;
+       /** last time we received status data from para_server */
+       struct timeval last_status_read;
        /** the offset value announced by para_server */
        int offset_seconds;
        /** the length of the current audio file as announced by para_server */
@@ -71,8 +73,6 @@ struct status_task {
        struct timeval sa_time_diff;
        /** whether client time is ahead of server time */
        int sa_time_diff_sign;
-       /** the audio format announced in server status */
-       char *af_status;
        /** non-zero if \a af_status is "playing" */
        int playing;
 };
index c738079b6b1f92ab47435bfea9eb6185aa52eef2..d13892599cd4b503c50164f9a7010ab40c6d2016 100644 (file)
@@ -295,29 +295,32 @@ int client_open(struct private_client_data *pcd)
        struct hostent *he;
        struct sockaddr_in their_addr;
 
+       pcd->fd = -1;
        ret = get_host_info(pcd->conf.hostname_arg, &he);
        if (ret < 0)
-               goto out;
+               goto err_out;
        /* get new socket */
        ret = get_socket();
        if (ret < 0)
-               goto out;
+               goto err_out;
        pcd->fd = ret;
        /* init their_addr */
        init_sockaddr(&their_addr, pcd->conf.server_port_arg, he);
        ret = para_connect(pcd->fd, &their_addr);
        if (ret < 0)
-               goto out;
+               goto err_out;
        pcd->status = CL_CONNECTED;
        ret = mark_fd_nonblock(pcd->fd);
        if (ret < 0)
-               goto out;
+               goto err_out;
        pcd->task.pre_select = client_pre_select;
        pcd->task.post_select = client_post_select;
        pcd->task.private_data = pcd;
        sprintf(pcd->task.status, "client");
        register_task(&pcd->task);
-       ret = 1;
-out:
+       return 1;
+err_out:
+       if (pcd->fd >= 0)
+               close(pcd->fd);
        return ret;
 }
index 52d56c9eba015880000db26e4183814434ad6f39..55070a3d7a89950051a1374c400511527c19b7a9 100644 (file)
--- a/command.c
+++ b/command.c
@@ -690,7 +690,9 @@ static int com_stat(int socket_fd, int argc, char **argv)
                ret = 1;
                if (num == 1)
                        goto out;
-               usleep(500000 * 100);
+               sleep(50);
+               if (getppid() == 1)
+                       return -E_SERVER_CRASH;
        }
 out:
        return ret;
diff --git a/crypt.c b/crypt.c
index 34407d782b910cab8f7e87aa269628d9a97aebf3..653b1a2452cdc85215d916c1abd35f641800dcf1 100644 (file)
--- a/crypt.c
+++ b/crypt.c
@@ -100,12 +100,14 @@ int para_decrypt_buffer(char *key_file, unsigned char *outbuf, unsigned char *in
 int para_decrypt_challenge(char *key_file, long unsigned *challenge_nr,
                unsigned char *inbuf, int rsa_inlen)
 {
-       unsigned char *rsa_out = OPENSSL_malloc(128);
+       unsigned char *rsa_out = OPENSSL_malloc(rsa_inlen + 1);
        int ret = para_decrypt_buffer(key_file, rsa_out, inbuf, rsa_inlen);
 
-       if (ret >= 0)
+       if (ret >= 0) {
+               rsa_out[ret] = '\0';
                ret = sscanf((char *)rsa_out, "%lu", challenge_nr) == 1?
                        1 : -E_CHALLENGE;
+       }
        OPENSSL_free(rsa_out);
        return ret;
 }
index 3592a2827a70b2441bc51a1bd6cbe7e1181d7374..bb46678e8cdd84bd58cbc609b1c8e19252407d7a 100644 (file)
@@ -132,7 +132,7 @@ again:
        if (ret < 0) {
                if (errno != EAGAIN || !retries++ > DCCP_RETRIES)
                        goto err_out;
-               PARA_DEBUG_LOG("EAGAIN #%d@%d/%d\n", retries, written, len);
+               PARA_DEBUG_LOG("EAGAIN #%d@%zd/%zd\n", retries, written, len);
                goto again;
        }
        retries = 0;
diff --git a/error.h b/error.h
index 89dbb0f69f1ffa984f740fa8b7a0e3b5d24d035b..3b31d82e529e7fb84955d4d2f2498a72812e709e 100644 (file)
--- a/error.h
+++ b/error.h
@@ -358,6 +358,7 @@ extern const char **para_errlist[];
        PARA_ERROR(BAD_USER, "you don't exist. Go away."), \
        PARA_ERROR(LOCK, "lock error"), \
        PARA_ERROR(SENDER_CMD, "command not supported by this sender"), \
+       PARA_ERROR(SERVER_CRASH, "para_server crashed -- can not live without it"), \
 
 
 #define PLAYLIST_SELECTOR_ERRORS \
diff --git a/gui.c b/gui.c
index c0588197c553e1728713e0e964c61041eb02e7ef..2513db6d4ad17746af1ece48e2b9b4a21a1efbac 100644 (file)
--- a/gui.c
+++ b/gui.c
@@ -56,8 +56,8 @@ void *bot_win_rb;
 
 static unsigned scroll_position;
 
-static int external_cmd_died, curses_active;
-static pid_t external_cmd_pid;
+static int cmd_died, curses_active;
+static pid_t cmd_pid;
 
 static int command_pipe = -1;
 static int audiod_pipe = -1;
@@ -735,9 +735,9 @@ reap_next_child:
        pid = para_reap_child();
        if (pid <= 0)
                return;
-       if (pid == external_cmd_pid) {
-               external_cmd_pid = 0;
-               external_cmd_died = 1;
+       if (pid == cmd_pid) {
+               cmd_pid = 0;
+               cmd_died = 1;
        }
        goto reap_next_child;
 }
@@ -867,7 +867,7 @@ static int open_audiod_pipe(void)
  *
  * EXTERNAL_MODE: Check only signal pipe. Used when an external command
  * is running. During that thime curses is disabled.  Returns when
- * external_cmd_pid == 0.
+ * cmd_pid == 0.
  */
 static int do_select(int mode)
 {
@@ -936,6 +936,16 @@ check_return:
                if (cp_numread <= 0)
                        cbo = 0;
                wrefresh(bot.win);
+               ret = wgetch(top.win);
+               if (ret != ERR && ret != KEY_RESIZE) {
+                       if (command_pipe) {
+                               close(command_pipe);
+                               command_pipe = -1;
+                       }
+                       if (cmd_pid)
+                               kill(cmd_pid, SIGTERM);
+                       return -1;
+               }
                break;
        case GETCH_MODE:
                ret = wgetch(top.win);
@@ -943,8 +953,8 @@ check_return:
                        return ret;
                break;
        case EXTERNAL_MODE:
-               if (external_cmd_died) {
-                       external_cmd_died = 0;
+               if (cmd_died) {
+                       cmd_died = 0;
                        return 0;
                }
        }
@@ -968,13 +978,12 @@ static int send_output(void)
 
 static int client_cmd_cmdline(char *cmd)
 {
-       pid_t pid;
        int ret, fds[3] = {0, 1, 0};
        char *c = make_message(BINDIR "/para_client %s", cmd);
 
        outputf(COLOR_COMMAND, "%s", c);
-       print_in_bar(COLOR_MSG, "executing client command, hit q to abort\n");
-       ret = para_exec_cmdline_pid(&pid, c, fds);
+       print_in_bar(COLOR_MSG, "executing client command, hit any key to abort\n");
+       ret = para_exec_cmdline_pid(&cmd_pid, c, fds);
        free(c);
        if (ret < 0)
                return -1;
@@ -987,12 +996,11 @@ static int client_cmd_cmdline(char *cmd)
  */
 static int display_cmd(char *cmd)
 {
-       pid_t pid;
        int fds[3] = {0, 1, 0};
 
-       print_in_bar(COLOR_MSG, "executing display command, hit q to abort");
+       print_in_bar(COLOR_MSG, "executing display command, hit any key to abort");
        outputf(COLOR_COMMAND, "%s", cmd);
-       if (para_exec_cmdline_pid(&pid, cmd, fds) < 0)
+       if (para_exec_cmdline_pid(&cmd_pid, cmd, fds) < 0)
                return -1;
        command_pipe = fds[1];
        return send_output();
@@ -1005,10 +1013,11 @@ static int external_cmd(char *cmd)
 {
        int fds[3] = {-1, -1, -1};
 
-       if (external_cmd_pid)
+       if (cmd_pid)
                return -1;
        shutdown_curses();
-       para_exec_cmdline_pid(&external_cmd_pid, cmd, fds);
+       para_exec_cmdline_pid(&cmd_pid, cmd, fds);
+       cmd_died = 0;
        do_select(EXTERNAL_MODE);
        init_curses();
        return 0;
index 386aacbcfc2c447e907e97c3bb630504ff87bdf9..c418af129a0560fdb09e2aa2cf32e1c7b68146ed 100644 (file)
@@ -198,8 +198,10 @@ static int http_recv_open(struct receiver_node *rn)
        PARA_NOTICE_LOG("connecting to %s:%d\n", conf->host_arg,
                conf->port_arg);
        ret = para_connect(phd->fd, &their_addr);
-       if (ret < 0)
+       if (ret < 0) {
+               close(phd->fd);
                goto err_out;
+       }
        mark_fd_nonblock(phd->fd);
        phd->status = HTTP_CONNECTED;
        return 1;
index 45a10bac0e9264e96b38dda81b7233370c02958e..51273644413ec0b67c4d100281857a023bac5d77 100644 (file)
@@ -1505,7 +1505,7 @@ static int com_mv(__a_unused int fd, int argc, char *argv[])
                goto out;
        ret = -E_MYSQL_SYNTAX;
        if (!strcmp(ebn1, ebn2))
-               goto out;
+               goto update_dir;
        remove_entry(argv[2]); /* no need to escape, ignore error */
        q = make_message("update data set name = '%s' where name = '%s'",
                ebn2, ebn1);
@@ -1522,6 +1522,7 @@ static int com_mv(__a_unused int fd, int argc, char *argv[])
        free(q);
        if (ret < 0)
                goto out;
+update_dir:
        ret = 1;
        dn = para_dirname(argv[2]);
        if (!dn)
diff --git a/net.c b/net.c
index b05f74da69b62d3fd3a25a7ac58633f1628c1249..66db86bc5f77ece9a628f705dee2198d921e3491 100644 (file)
--- a/net.c
+++ b/net.c
@@ -312,9 +312,9 @@ int para_connect(int fd, struct sockaddr_in *their_addr)
 /**
  * paraslash's wrapper around the accept system call
  *
- * @param fd the listening socket
- * @param addr structure which is filled in with the address of the peer socket
- * @param size should contain the size of the structure pointed to by \a addr
+ * \param fd the listening socket
+ * \param addr structure which is filled in with the address of the peer socket
+ * \param size should contain the size of the structure pointed to by \a addr
  *
  * \sa accept(2).
  */
@@ -322,8 +322,10 @@ int para_accept(int fd, void *addr, socklen_t size)
 {
        int new_fd;
 
-       new_fd = accept(fd, (struct sockaddr *) addr, &size);
-       return new_fd == -1? -E_ACCEPT : new_fd;
+       do 
+               new_fd = accept(fd, (struct sockaddr *) addr, &size);
+       while (new_fd < 0 && errno == EINTR);
+       return new_fd < 0? -E_ACCEPT : new_fd;
 }
 
 static int setserversockopts(int socket_fd)
index 1e394499fa2a357e3adc2ef4ba715443694b6278..a6e29fc0ca86512b88be1176657c2cd78fd0deae 100755 (executable)
@@ -6,7 +6,7 @@ dir="$HOME/.paraslash"
 client_conf="$dir/client.conf"
 audioc_conf="$dir/audioc.conf"
 server=www.paraslash.org
-proj=paraslash-0.2.12
+proj=paraslash-0.2.13
 df=$proj.tar.bz2 # download file
 url=http://$server/versions/$df
 kf="$dir/key.anonymous" # key file
diff --git a/versions/paraslash-0.2.13.tar.bz2 b/versions/paraslash-0.2.13.tar.bz2
new file mode 100644 (file)
index 0000000..f3665ee
Binary files /dev/null and b/versions/paraslash-0.2.13.tar.bz2 differ
diff --git a/versions/paraslash-0.2.13.tar.bz2.asc b/versions/paraslash-0.2.13.tar.bz2.asc
new file mode 100644 (file)
index 0000000..a53d791
--- /dev/null
@@ -0,0 +1,7 @@
+-----BEGIN PGP SIGNATURE-----
+Version: GnuPG v1.4.4 (GNU/Linux)
+
+iD8DBQBEt6wNWto1QDEAkw8RAlwOAJ9LyZP8oKHWLeKBujynpL7MJelegACdGW5l
+/93tWtJYKMp2GrRCx2UQh6o=
+=KLcm
+-----END PGP SIGNATURE-----
index 1299baf992921dc8fa299d864d316f155c167987..47db1f1534ddb41cdcee585dba0b4c621c9e0930 100644 (file)
@@ -1,6 +1,10 @@
 <h1>Events</h1>
 <hr>
 <ul>
+       <li>2007-07-14: <a href="versions/paraslash-0.2.13.tar.bz2">paraslash-0.2.13</a>
+               <a href="versions/paraslash-0.2.13.tar.bz2.asc">(sig)</a>
+               "sonic convolution"
+       </li>
        <li>2006-05-12: <a href="versions/paraslash-0.2.12.tar.bz2">paraslash-0.2.12</a>
                <a href="versions/paraslash-0.2.12.tar.bz2.asc">(sig)</a>
                "oriented abstraction"