From: Andre Noll Date: Sun, 14 Dec 2014 20:48:06 +0000 (+0100) Subject: Merge branch 'refs/heads/t/com_tasks' X-Git-Tag: v0.5.4~43 X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=commitdiff_plain;h=32a81d7eecfa5c8585d7095631ff2cd8b7b1bf7a;hp=-c Merge branch 'refs/heads/t/com_tasks' cooking for almost a month. --- 32a81d7eecfa5c8585d7095631ff2cd8b7b1bf7a diff --combined NEWS index 87337d1c,305d9147..b945484b --- a/NEWS +++ b/NEWS @@@ -5,16 -5,12 +5,17 @@@ NEW 0.5.4 (to be announced) "exponential alignment" ----------------------------------------------- +Another cleanup and bugfix release. + ++ - New server command: tasks. - Minor cleanups to daemon.c. - New URLs for home page and git services. - Improved error diagnostics for the mvblob commands. - New sender subcommand: status. - Improved help text for server and afs commands. - audiod memory leak fixes. + - Miscellaneous improvements to the build system. + - oss_writer improvements. Download: ./releases/paraslash-git.tar.bz2 diff --combined client.c index 2159117e,e0c97826..f53147f1 --- a/client.c +++ b/client.c @@@ -35,8 -35,8 +35,8 @@@ __printf_2_3 void (*para_log)(int, cons #ifdef HAVE_READLINE #include "interactive.h" -#include "server_completion.h" -#include "afs_completion.h" +#include "server.completion.h" +#include "afs.completion.h" struct exec_task { struct task *task; @@@ -208,6 -208,7 +208,7 @@@ I9E_DUMMY_COMPLETER(version) I9E_DUMMY_COMPLETER(stop); I9E_DUMMY_COMPLETER(addatt); I9E_DUMMY_COMPLETER(init); + I9E_DUMMY_COMPLETER(tasks); static struct i9e_completer completers[]; diff --combined command.c index 551fe05a,6880cb40..a9f5aa69 --- a/command.c +++ b/command.c @@@ -35,8 -35,8 +35,8 @@@ #include "fd.h" #include "ipc.h" #include "user_list.h" -#include "server_command_list.h" -#include "afs_command_list.h" +#include "server.command_list.h" +#include "afs.command_list.h" #include "signal.h" #include "version.h" @@@ -363,10 -363,8 +363,10 @@@ static int com_sender(struct command_co for (i = 0; i < 10; i++) { mutex_lock(mmd_mutex); if (mmd->sender_cmd_data.cmd_num >= 0) { + /* another sender command is active, retry in 100ms */ + struct timespec ts = {.tv_nsec = 100 * 1000 * 1000}; mutex_unlock(mmd_mutex); - usleep(100 * 1000); + nanosleep(&ts, NULL); continue; } mmd->sender_cmd_data = scd; @@@ -718,7 -716,7 +718,7 @@@ static int com_ff(struct command_contex promille += 1000 * i / mmd->afd.afhi.seconds_total; if (promille < 0) promille = 0; - if (promille > 1000) { + if (promille > 1000) { mmd->new_vss_status_flags |= VSS_NEXT; goto out; } @@@ -749,8 -747,8 +749,8 @@@ static int com_jmp(struct command_conte if (i > 100) i = 100; PARA_INFO_LOG("jumping to %lu%%\n", i); - mmd->repos_request = (mmd->afd.afhi.chunks_total * i + 50)/ 100; - PARA_INFO_LOG("sent: %lu, offset before jmp: %lu\n", + mmd->repos_request = (mmd->afd.afhi.chunks_total * i + 50) / 100; + PARA_INFO_LOG("sent: %lu, offset before jmp: %lu\n", mmd->chunks_sent, mmd->offset); mmd->new_vss_status_flags |= VSS_REPOS; mmd->new_vss_status_flags &= ~VSS_NEXT; @@@ -761,6 -759,16 +761,16 @@@ out return ret; } + static int com_tasks(struct command_context *cc) + { + char *tl = server_get_tasks(); + int ret = 1; + + if (tl) + ret = send_sb(&cc->scc, tl, strlen(tl), SBD_OUTPUT, false); + return ret; + } + /* * check if perms are sufficient to exec a command having perms cmd_perms. * Returns 0 if perms are sufficient, -E_PERM otherwise. @@@ -865,24 -873,22 +875,22 @@@ out * \param fd The file descriptor to send output to. * \param peername Identifies the connecting peer. * - * Whenever para_server accepts an incoming tcp connection on - * the port it listens on, it forks and the resulting child - * calls this function. + * Whenever para_server accepts an incoming tcp connection on the port it + * listens on, it forks and the resulting child calls this function. * - * An RSA-based challenge/response is used to authenticate - * the peer. It that authentication succeeds, a random - * session key is generated and sent back to the peer, - * encrypted with its RSA public key. From this point on, - * all transfers are crypted with this session key. + * An RSA-based challenge/response is used to authenticate the peer. It that + * authentication succeeds, a random session key is generated and sent back to + * the peer, encrypted with its RSA public key. From this point on, all + * transfers are crypted with this session key. * - * Next it is checked if the peer supplied a valid server command or a command - * for the audio file selector. If yes, and if the user has sufficient + * Next it is checked if the peer supplied a valid server command or a command + * for the audio file selector. If yes, and if the user has sufficient * permissions to execute that command, the function calls the corresponding * command handler which does argument checking and further processing. * - * In order to cope with a DOS attacks, a timeout is set up - * which terminates the function if the connection was not - * authenticated when the timeout expires. + * In order to cope with a DOS attacks, a timeout is set up which terminates + * the function if the connection was not authenticated when the timeout + * expires. * * \sa alarm(2), crypt.c, crypt.h */ @@@ -905,7 -911,7 +913,7 @@@ __noreturn void handle_connect(int fd, goto net_err; /* send Welcome message */ ret = write_va_buffer(fd, "This is para_server, version " - PACKAGE_VERSION ".\n" + PACKAGE_VERSION ".\n" "Features: sideband,aes_ctr128\n" ); if (ret < 0)