From 8cbd8c1882e33380875f2723cad258784ba3a360 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lo=C3=AFc=20Hoguin?= Date: Fri, 7 Nov 2014 19:22:36 +0200 Subject: Rename 'shutdown' close reason and tuples to 'stop' The 'shutdown' atom has a specific meaning inside OTP. We are instead going to use 'stop' which is pretty much the equivalent of what we actually do. 'shutdown' is now reserved for future special processes implementation. --- doc/src/guide/loop_handlers.ezdoc | 6 +++--- doc/src/guide/ws_handlers.ezdoc | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'doc/src/guide') diff --git a/doc/src/guide/loop_handlers.ezdoc b/doc/src/guide/loop_handlers.ezdoc index 2324cfd..879013b 100644 --- a/doc/src/guide/loop_handlers.ezdoc +++ b/doc/src/guide/loop_handlers.ezdoc @@ -61,7 +61,7 @@ message otherwise. ``` erlang info({reply, Body}, Req, State) -> Req2 = cowboy_req:reply(200, [], Body, Req), - {shutdown, Req2, State}; + {stop, Req2, State}; info(_Msg, Req, State) -> {ok, Req, State, hibernate}. ``` @@ -76,7 +76,7 @@ return a tuple indicating if more messages are to be expected. The callback may also choose to do nothing at all and just skip the message received. -If a reply is sent, then the `shutdown` tuple should be returned. +If a reply is sent, then the `stop` tuple should be returned. This will instruct Cowboy to end the request. Otherwise an `ok` tuple should be returned. @@ -99,7 +99,7 @@ init(Req, Opts) -> {cowboy_loop, Req2, Opts}. info(eof, Req, State) -> - {shutdown, Req, State}; + {stop, Req, State}; info({chunk, Chunk}, Req, State) -> cowboy_req:chunk(Chunk, Req), {ok, Req, State}; diff --git a/doc/src/guide/ws_handlers.ezdoc b/doc/src/guide/ws_handlers.ezdoc index cb30511..811e021 100644 --- a/doc/src/guide/ws_handlers.ezdoc +++ b/doc/src/guide/ws_handlers.ezdoc @@ -42,7 +42,7 @@ init(Req, _Opts) -> <<"mychat2">>, Req), {ok, Req2, #state{}}; false -> - {shutdown, Req, undefined} + {stop, Req, undefined} end end. ``` @@ -75,7 +75,7 @@ ping or pong frame arrives from the client. Note that in the case of ping and pong frames, no action is expected as Cowboy automatically replies to ping frames. -The handler can decide to send frames to the socket, shutdown +The handler can decide to send frames to the socket, stop or just continue without sending anything. The following snippet echoes back any text frame received and @@ -93,7 +93,7 @@ websocket_handle(_Frame, Req, State) -> Cowboy will call `websocket_info/3` whenever an Erlang message arrives. -The handler can decide to send frames to the socket, shutdown +The handler can decide to send frames to the socket, stop or just continue without sending anything. The following snippet forwards any `log` message to the socket -- cgit v1.2.3