aboutsummaryrefslogtreecommitdiffstats
path: root/src/cowboy_requests_sup.erl
diff options
context:
space:
mode:
authorLoïc Hoguin <[email protected]>2011-08-10 20:28:30 +0200
committerLoïc Hoguin <[email protected]>2011-08-10 20:28:30 +0200
commit43d14b52cd07dfd1121bbe6727a96dfd32304e47 (patch)
tree5b8d451d0decec8e75cf70c24e5c3fb54f51a65c /src/cowboy_requests_sup.erl
parent56369d5c1a0a3141e9d136b2f8010ff0e96bb26c (diff)
downloadcowboy-43d14b52cd07dfd1121bbe6727a96dfd32304e47.tar.gz
cowboy-43d14b52cd07dfd1121bbe6727a96dfd32304e47.tar.bz2
cowboy-43d14b52cd07dfd1121bbe6727a96dfd32304e47.zip
Give the ListenerPid to the protocol on startup
Also sends a message 'shoot' that can be received by the protocol to make sure Cowboy has had enough time to fully initialize the socket. This message should be received before any socket-related operations are performed. WebSocket request connections are now moved from the pool 'default' to the pool 'websocket', meaning we can have a lot of running WebSockets despite having a low 'max_connections' setting.
Diffstat (limited to 'src/cowboy_requests_sup.erl')
-rw-r--r--src/cowboy_requests_sup.erl9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/cowboy_requests_sup.erl b/src/cowboy_requests_sup.erl
index a50ee8a..87d5352 100644
--- a/src/cowboy_requests_sup.erl
+++ b/src/cowboy_requests_sup.erl
@@ -16,7 +16,7 @@
-module(cowboy_requests_sup).
-behaviour(supervisor).
--export([start_link/0, start_request/4]). %% API.
+-export([start_link/0, start_request/5]). %% API.
-export([init/1]). %% supervisor.
%% API.
@@ -25,9 +25,10 @@
start_link() ->
supervisor:start_link(?MODULE, []).
--spec start_request(inet:socket(), module(), module(), any()) -> {ok, pid()}.
-start_request(Socket, Transport, Protocol, Opts) ->
- Protocol:start_link(Socket, Transport, Opts).
+-spec start_request(pid(), inet:socket(), module(), module(), any())
+ -> {ok, pid()}.
+start_request(ListenerPid, Socket, Transport, Protocol, Opts) ->
+ Protocol:start_link(ListenerPid, Socket, Transport, Opts).
%% supervisor.