aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2019-10-03 10:09:35 +0200
committerLoïc Hoguin <[email protected]>2019-10-03 10:09:35 +0200
commit99df823cc32fed641c15722e22e8d6a5969a77c6 (patch)
treeac7736e15986c1eb202a6d4c93ea44912eea184e
parente4a535cfa6e27ac09c3f90b735748ad31cd78039 (diff)
downloadcowboy-99df823cc32fed641c15722e22e8d6a5969a77c6.tar.gz
cowboy-99df823cc32fed641c15722e22e8d6a5969a77c6.tar.bz2
cowboy-99df823cc32fed641c15722e22e8d6a5969a77c6.zip
Document stopping the listener in App:stop/1
-rw-r--r--doc/src/guide/listeners.asciidoc15
-rw-r--r--examples/chunked_hello_world/src/chunked_hello_world_app.erl2
-rw-r--r--examples/compress_response/src/compress_response_app.erl2
-rw-r--r--examples/cookie/src/cookie_app.erl2
-rw-r--r--examples/echo_get/src/echo_get_app.erl2
-rw-r--r--examples/echo_post/src/echo_post_app.erl2
-rw-r--r--examples/eventsource/src/eventsource_app.erl2
-rw-r--r--examples/file_server/src/file_server_app.erl2
-rw-r--r--examples/hello_world/src/hello_world_app.erl2
-rw-r--r--examples/markdown_middleware/src/markdown_middleware_app.erl2
-rw-r--r--examples/rest_basic_auth/src/rest_basic_auth_app.erl2
-rw-r--r--examples/rest_hello_world/src/rest_hello_world_app.erl2
-rw-r--r--examples/rest_pastebin/src/rest_pastebin_app.erl2
-rw-r--r--examples/ssl_hello_world/src/ssl_hello_world_app.erl2
-rw-r--r--examples/upload/src/upload_app.erl2
-rw-r--r--examples/websocket/src/websocket_app.erl2
16 files changed, 29 insertions, 16 deletions
diff --git a/doc/src/guide/listeners.asciidoc b/doc/src/guide/listeners.asciidoc
index 7701923..04169f9 100644
--- a/doc/src/guide/listeners.asciidoc
+++ b/doc/src/guide/listeners.asciidoc
@@ -75,7 +75,7 @@ start(_Type, _Args) ->
Dispatch = cowboy_router:compile([
{'_', [{"/", hello_handler, []}]}
]),
- {ok, _} = cowboy:start_tls(my_http_listener,
+ {ok, _} = cowboy:start_tls(my_https_listener,
[
{port, 8443},
{certfile, "/path/to/certfile"},
@@ -101,6 +101,19 @@ Cowboy 2.0 gets released.
Compatibility with HTTP/1.0 is provided by Cowboy's HTTP/1.1
implementation.
+=== Stopping the listener
+
+When starting listeners along with the application it is
+a good idea to also stop the listener when the application
+stops. This can be done by calling `cowboy:stop_listener/1`
+in the application's stop function:
+
+[source,erlang]
+----
+stop(_State) ->
+ ok = cowboy:stop_listener(my_http_listener).
+----
+
=== Protocol configuration
The HTTP/1.1 and HTTP/2 protocols share the same semantics;
diff --git a/examples/chunked_hello_world/src/chunked_hello_world_app.erl b/examples/chunked_hello_world/src/chunked_hello_world_app.erl
index 9c6eb1d..70d63f5 100644
--- a/examples/chunked_hello_world/src/chunked_hello_world_app.erl
+++ b/examples/chunked_hello_world/src/chunked_hello_world_app.erl
@@ -22,4 +22,4 @@ start(_Type, _Args) ->
chunked_hello_world_sup:start_link().
stop(_State) ->
- ok.
+ ok = cowboy:stop_listener(http).
diff --git a/examples/compress_response/src/compress_response_app.erl b/examples/compress_response/src/compress_response_app.erl
index b5cba52..b35fd6f 100644
--- a/examples/compress_response/src/compress_response_app.erl
+++ b/examples/compress_response/src/compress_response_app.erl
@@ -23,4 +23,4 @@ start(_Type, _Args) ->
compress_response_sup:start_link().
stop(_State) ->
- ok.
+ ok = cowboy:stop_listener(http).
diff --git a/examples/cookie/src/cookie_app.erl b/examples/cookie/src/cookie_app.erl
index da086e2..358d882 100644
--- a/examples/cookie/src/cookie_app.erl
+++ b/examples/cookie/src/cookie_app.erl
@@ -22,4 +22,4 @@ start(_Type, _Args) ->
cookie_sup:start_link().
stop(_State) ->
- ok.
+ ok = cowboy:stop_listener(http).
diff --git a/examples/echo_get/src/echo_get_app.erl b/examples/echo_get/src/echo_get_app.erl
index c2fd0df..5b15fb3 100644
--- a/examples/echo_get/src/echo_get_app.erl
+++ b/examples/echo_get/src/echo_get_app.erl
@@ -22,4 +22,4 @@ start(_Type, _Args) ->
echo_get_sup:start_link().
stop(_State) ->
- ok.
+ ok = cowboy:stop_listener(http).
diff --git a/examples/echo_post/src/echo_post_app.erl b/examples/echo_post/src/echo_post_app.erl
index b454740..4a057bb 100644
--- a/examples/echo_post/src/echo_post_app.erl
+++ b/examples/echo_post/src/echo_post_app.erl
@@ -22,4 +22,4 @@ start(_Type, _Args) ->
echo_post_sup:start_link().
stop(_State) ->
- ok.
+ ok = cowboy:stop_listener(http).
diff --git a/examples/eventsource/src/eventsource_app.erl b/examples/eventsource/src/eventsource_app.erl
index 932306e..825f434 100644
--- a/examples/eventsource/src/eventsource_app.erl
+++ b/examples/eventsource/src/eventsource_app.erl
@@ -23,4 +23,4 @@ start(_Type, _Args) ->
eventsource_sup:start_link().
stop(_State) ->
- ok.
+ ok = cowboy:stop_listener(http).
diff --git a/examples/file_server/src/file_server_app.erl b/examples/file_server/src/file_server_app.erl
index 89d5af0..17e73b2 100644
--- a/examples/file_server/src/file_server_app.erl
+++ b/examples/file_server/src/file_server_app.erl
@@ -26,4 +26,4 @@ start(_Type, _Args) ->
file_server_sup:start_link().
stop(_State) ->
- ok.
+ ok = cowboy:stop_listener(http).
diff --git a/examples/hello_world/src/hello_world_app.erl b/examples/hello_world/src/hello_world_app.erl
index 5922948..daa7d19 100644
--- a/examples/hello_world/src/hello_world_app.erl
+++ b/examples/hello_world/src/hello_world_app.erl
@@ -22,4 +22,4 @@ start(_Type, _Args) ->
hello_world_sup:start_link().
stop(_State) ->
- ok.
+ ok = cowboy:stop_listener(http).
diff --git a/examples/markdown_middleware/src/markdown_middleware_app.erl b/examples/markdown_middleware/src/markdown_middleware_app.erl
index 819fd53..75b3bc7 100644
--- a/examples/markdown_middleware/src/markdown_middleware_app.erl
+++ b/examples/markdown_middleware/src/markdown_middleware_app.erl
@@ -23,4 +23,4 @@ start(_Type, _Args) ->
markdown_middleware_sup:start_link().
stop(_State) ->
- ok.
+ ok = cowboy:stop_listener(http).
diff --git a/examples/rest_basic_auth/src/rest_basic_auth_app.erl b/examples/rest_basic_auth/src/rest_basic_auth_app.erl
index d595706..f95dc36 100644
--- a/examples/rest_basic_auth/src/rest_basic_auth_app.erl
+++ b/examples/rest_basic_auth/src/rest_basic_auth_app.erl
@@ -22,4 +22,4 @@ start(_Type, _Args) ->
rest_basic_auth_sup:start_link().
stop(_State) ->
- ok.
+ ok = cowboy:stop_listener(http).
diff --git a/examples/rest_hello_world/src/rest_hello_world_app.erl b/examples/rest_hello_world/src/rest_hello_world_app.erl
index 85bd9b5..40dd890 100644
--- a/examples/rest_hello_world/src/rest_hello_world_app.erl
+++ b/examples/rest_hello_world/src/rest_hello_world_app.erl
@@ -22,4 +22,4 @@ start(_Type, _Args) ->
rest_hello_world_sup:start_link().
stop(_State) ->
- ok.
+ ok = cowboy:stop_listener(http).
diff --git a/examples/rest_pastebin/src/rest_pastebin_app.erl b/examples/rest_pastebin/src/rest_pastebin_app.erl
index 0fbfd64..a5e7ebc 100644
--- a/examples/rest_pastebin/src/rest_pastebin_app.erl
+++ b/examples/rest_pastebin/src/rest_pastebin_app.erl
@@ -22,4 +22,4 @@ start(_Type, _Args) ->
rest_pastebin_sup:start_link().
stop(_State) ->
- ok.
+ ok = cowboy:stop_listener(http).
diff --git a/examples/ssl_hello_world/src/ssl_hello_world_app.erl b/examples/ssl_hello_world/src/ssl_hello_world_app.erl
index 4a9122f..959dc77 100644
--- a/examples/ssl_hello_world/src/ssl_hello_world_app.erl
+++ b/examples/ssl_hello_world/src/ssl_hello_world_app.erl
@@ -26,4 +26,4 @@ start(_Type, _Args) ->
ssl_hello_world_sup:start_link().
stop(_State) ->
- ok.
+ ok = cowboy:stop_listener(https).
diff --git a/examples/upload/src/upload_app.erl b/examples/upload/src/upload_app.erl
index 2ed5804..6fb829f 100644
--- a/examples/upload/src/upload_app.erl
+++ b/examples/upload/src/upload_app.erl
@@ -22,4 +22,4 @@ start(_Type, _Args) ->
upload_sup:start_link().
stop(_State) ->
- ok.
+ ok = cowboy:stop_listener(http).
diff --git a/examples/websocket/src/websocket_app.erl b/examples/websocket/src/websocket_app.erl
index 92c7edc..babb39e 100644
--- a/examples/websocket/src/websocket_app.erl
+++ b/examples/websocket/src/websocket_app.erl
@@ -23,4 +23,4 @@ start(_Type, _Args) ->
websocket_sup:start_link().
stop(_State) ->
- ok.
+ ok = cowboy:stop_listener(http).