aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy.erl
diff options
context:
space:
mode:
Diffstat (limited to 'src/cowboy.erl')
-rw-r--r--src/cowboy.erl10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/cowboy.erl b/src/cowboy.erl
index 6931114..6aa5786 100644
--- a/src/cowboy.erl
+++ b/src/cowboy.erl
@@ -27,7 +27,11 @@ start_listener(Ref, NbAcceptors, Transport, TransOpts, Protocol, ProtoOpts) ->
]},
permanent, 5000, supervisor, [cowboy_listener_sup]}).
--spec stop_listener(Ref::term()) -> ok.
+-spec stop_listener(Ref::term()) -> ok | {error, not_found}.
stop_listener(Ref) ->
- supervisor:terminate_child(cowboy_sup, {cowboy_listener_sup, Ref}),
- supervisor:delete_child(cowboy_sup, {cowboy_listener_sup, Ref}).
+ case supervisor:terminate_child(cowboy_sup, {cowboy_listener_sup, Ref}) of
+ ok ->
+ supervisor:delete_child(cowboy_sup, {cowboy_listener_sup, Ref});
+ {error, Reason} ->
+ {error, Reason}
+ end.