~ubuntu-branches/ubuntu/saucy/rabbitmq-server/saucy

« back to all changes in this revision

Viewing changes to plugins-src/cowboy-wrapper/cowboy-git/src/cowboy_requests_sup.erl

  • Committer: Package Import Robot
  • Author(s): Emile Joubert
  • Date: 2012-11-19 11:42:31 UTC
  • mfrom: (0.2.18) (0.1.32 sid)
  • Revision ID: package-import@ubuntu.com-20121119114231-hvapkn4akng09etr
Tags: 3.0.0-1
New upstream release

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
%% Copyright (c) 2011, Loïc Hoguin <essen@dev-extend.eu>
 
2
%%
 
3
%% Permission to use, copy, modify, and/or distribute this software for any
 
4
%% purpose with or without fee is hereby granted, provided that the above
 
5
%% copyright notice and this permission notice appear in all copies.
 
6
%%
 
7
%% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 
8
%% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 
9
%% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 
10
%% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 
11
%% WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 
12
%% ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 
13
%% OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 
14
 
 
15
%% @private
 
16
-module(cowboy_requests_sup).
 
17
-behaviour(supervisor).
 
18
 
 
19
-export([start_link/0, start_request/5]). %% API.
 
20
-export([init/1]). %% supervisor.
 
21
 
 
22
%% API.
 
23
 
 
24
-spec start_link() -> {ok, pid()}.
 
25
start_link() ->
 
26
        supervisor:start_link(?MODULE, []).
 
27
 
 
28
-spec start_request(pid(), inet:socket(), module(), module(), any())
 
29
        -> {ok, pid()}.
 
30
start_request(ListenerPid, Socket, Transport, Protocol, Opts) ->
 
31
        Protocol:start_link(ListenerPid, Socket, Transport, Opts).
 
32
 
 
33
%% supervisor.
 
34
 
 
35
-spec init([]) -> {ok, {{simple_one_for_one, 0, 1}, [{_, _, _, _, _, _}, ...]}}.
 
36
init([]) ->
 
37
        {ok, {{simple_one_for_one, 0, 1}, [{?MODULE, {?MODULE, start_request, []},
 
38
                temporary, brutal_kill, worker, [?MODULE]}]}}.