This is great work, this is going to eliminate a lot of confusion
On Wed, Jan 28, 2009 at 8:58 PM, Eric Merritt <[email protected]> wrote:
>
> ---
> server/sinan_web_api/src/swa_crary_handler.erl | 22
> ++++++++++++++++++++--
> 1 files changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/server/sinan_web_api/src/swa_crary_handler.erl
> b/server/sinan_web_api/src/swa_crary_handler.erl
> index e90c1a0..5536ddd 100644
> --- a/server/sinan_web_api/src/swa_crary_handler.erl
> +++ b/server/sinan_web_api/src/swa_crary_handler.erl
> @@ -105,13 +105,31 @@ handle_do_request(["do_task", "release"], Req,
> BuildRef, Args) ->
> handle_do_request(["do_task", "dist"], Req, BuildRef, Args) ->
> swa_sup:start_handler(BuildRef, Req),
> sinan:dist(BuildRef, Args);
> +handle_do_request(["do_task", "shutdown"], Req, _, _) ->
> + case application:get_env(sinan, may_shutdown) of
> + false ->
> + write_out(Req, "Not allowed to respond to shutdown requests!");
> + _ ->
> + write_out(Req, "Shutting down now!"),
> + init:stop()
> + end;
> handle_do_request(["do_task", Task], Req, _, _) ->
> + write_out(Req, "I don't know how to do " ++ Task).
> +
> +%%--------------------------------------------------------------------
> +%% @doc
> +%% Write out an arbitrary message to the client
> +%% @spec (Req, Message) -> ok
> +%% @end
> +%%--------------------------------------------------------------------
> +write_out(Req, Message) ->
> Writer = crary_body:new_writer(Req),
> JDesc = {obj, [{type, run_event},
> {event_type, stop},
> - {desc, list_to_binary("I don't know how to do " ++
> Task)}]},
> + {desc, list_to_binary(Message)}]},
> Content = ktj_encode:encode(JDesc),
> crary:r(Writer, ok, [{"content-type", "application/json"},
> - {<<"content-length">>,
> integer_to_list(iolist_size(Content))}]),
> + {<<"content-length">>,
> + integer_to_list(iolist_size(Content))}]),
> crary_sock:write(Writer, Content),
> crary_sock:done_writing(Writer).
> --
> 1.6.1
>
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"erlware-dev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/erlware-dev?hl=en
-~----------~----~----~----~------~----~------~--~---