X-Git-Url: http://git.tuebingen.mpg.de/?p=paraslash.git;a=blobdiff_plain;f=afs.c;h=da92d6c5bd0058ca09dd95cc2887640b7285b7d5;hp=a1381e738a40cf644abeb16cf8356e7c578839a6;hb=277ed4a605f68118aff9e671f16c0ac6edb1d55a;hpb=01a7db579a518a1a03b940a5a42411e49123ac1b diff --git a/afs.c b/afs.c index a1381e73..da92d6c5 100644 --- a/afs.c +++ b/afs.c @@ -1,5 +1,5 @@ /* - * Copyright (C) 2007-2012 Andre Noll + * Copyright (C) 2007-2013 Andre Noll * * Licensed under the GPL v2. For licencing details see COPYING. */ @@ -87,7 +87,7 @@ 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 */ +static char *current_mop; /* mode or playlist specifier. NULL means dummy mood */ /** * A random number used to "authenticate" the connection. @@ -113,7 +113,7 @@ extern uint32_t afs_socket_cookie; * area is written to the command socket. * * The afs process accepts connections on the command socket and reads the - * shared memory id, attaches the corresponing area, calls the given handler to + * shared memory id, attaches the corresponding area, calls the given handler to * perform the desired action and to optionally compute a result. * * The result and a \p callback_result structure is then written to another @@ -133,7 +133,7 @@ struct callback_query { /** * Structure embedded in the result of a callback. * - * If the callback produced a result, an instance of that structure is embeeded + * If the callback produced a result, an instance of that structure is embedded * into the shared memory area holding the result, mainly to let the command * handler know the size of the result. * @@ -604,12 +604,10 @@ int afs_cb_result_handler(struct osl_object *result, uint8_t band, { struct command_context *cc = private; + assert(cc); if (!result->size) return 1; - if (cc->use_sideband) - return send_sb(&cc->scc, result->data, result->size, band, - true); - return sc_send_bin_buffer(&cc->scc, result->data, result->size); + return send_sb(&cc->scc, result->data, result->size, band, true); } int com_select(struct command_context *cc) @@ -744,7 +742,7 @@ static void afs_signal_post_select(struct sched *s, struct task *t) } PARA_EMERG_LOG("terminating on signal %d\n", signum); shutdown: - sched_shutdown(s); + task_notify_all(s, E_AFS_SIGNAL); t->error = -E_AFS_SIGNAL; } @@ -921,10 +919,16 @@ static void command_post_select(struct sched *s, struct task *t) struct afs_client *client, *tmp; int fd, ret; + ret = task_get_notification(t); + if (ret < 0) { + t->error = ret; + return; + } ret = execute_server_command(&s->rfds); if (ret < 0) { PARA_EMERG_LOG("%s\n", para_strerror(-ret)); - sched_shutdown(s); + task_notify_all(s, -ret); + t->error = ret; return; } /* Check the list of connected clients. */ @@ -1063,9 +1067,6 @@ int com_init(struct command_context *cc) } ret = send_callback_request(create_tables_callback, &query, afs_cb_result_handler, cc); - if (ret < 0) - /* ignore return value */ - sc_send_va_buffer(&cc->scc, "%s\n", para_strerror(-ret)); return ret; }