~clint-fewbar/ubuntu/precise/erlang/merge-15b

« back to all changes in this revision

Viewing changes to lib/inets/src/http_server/httpd_sup.erl

  • Committer: Package Import Robot
  • Author(s): Sergei Golovan
  • Date: 2011-12-15 19:20:10 UTC
  • mfrom: (1.1.18) (3.5.15 sid)
  • mto: (3.5.16 sid)
  • mto: This revision was merged to the branch mainline in revision 33.
  • Revision ID: package-import@ubuntu.com-20111215192010-jnxcfe3tbrpp0big
Tags: 1:15.b-dfsg-1
* New upstream release.
* Upload to experimental because this release breaks external drivers
  API along with ABI, so several applications are to be fixed.
* Removed SSL patch because the old SSL implementation is removed from
  the upstream distribution.
* Removed never used patch which added native code to erlang beam files.
* Removed the erlang-docbuilder binary package because the docbuilder
  application was dropped by upstream.
* Documented dropping ${erlang-docbuilder:Depends} substvar in
  erlang-depends(1) manpage.
* Made erlang-base and erlang-base-hipe provide virtual package
  erlang-abi-15.b (the number means the first erlang version, which
  provides current ABI).

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
%%
2
2
%% %CopyrightBegin%
3
3
%%
4
 
%% Copyright Ericsson AB 2004-2010. All Rights Reserved.
 
4
%% Copyright Ericsson AB 2004-2011. All Rights Reserved.
5
5
%%
6
6
%% The contents of this file are subject to the Erlang Public License,
7
7
%% Version 1.1, (the "License"); you may not use this file except in
90
90
%%%  Supervisor callback
91
91
%%%=========================================================================
92
92
init([HttpdServices]) ->
93
 
    ?hdrd("starting", []),
 
93
    ?hdrd("starting", [{httpd_service, HttpdServices}]),
94
94
    RestartStrategy = one_for_one,
95
95
    MaxR = 10,
96
96
    MaxT = 3600,
182
182
            Error
183
183
    end.
184
184
 
185
 
httpd_child_spec(Config, AcceptTimeout, Debug, Addr, 0) ->
186
 
        case start_listen(Addr, 0, Config) of
187
 
            {Pid, {NewPort, NewConfig, ListenSocket}} ->
188
 
                Name      = {httpd_instance_sup, Addr, NewPort},
189
 
                StartFunc = {httpd_instance_sup, start_link,
190
 
                             [NewConfig, AcceptTimeout, 
191
 
                              {Pid, ListenSocket}, Debug]},
192
 
                Restart   = permanent, 
193
 
                Shutdown  = infinity,
194
 
                Modules   = [httpd_instance_sup],
195
 
                Type      = supervisor,
196
 
                {Name, StartFunc, Restart, Shutdown, Type, Modules};
197
 
            {Pid, {error, Reason}}  ->
198
 
                exit(Pid, normal),
199
 
                {error, Reason}
200
 
        end;
 
185
httpd_child_spec(Config, AcceptTimeout, Debug, Addr, Port) ->
 
186
    case Port == 0 orelse proplists:is_defined(fd, Config) of
 
187
        true ->
 
188
            httpd_child_spec_listen(Config, AcceptTimeout, Debug, Addr, Port);
 
189
        false ->
 
190
            httpd_child_spec_nolisten(Config, AcceptTimeout, Debug, Addr, Port)
 
191
    end.
 
192
 
 
193
httpd_child_spec_listen(Config, AcceptTimeout, Debug, Addr, Port) ->
 
194
    case start_listen(Addr, Port, Config) of
 
195
        {Pid, {NewPort, NewConfig, ListenSocket}} ->
 
196
            Name      = {httpd_instance_sup, Addr, NewPort},
 
197
            StartFunc = {httpd_instance_sup, start_link,
 
198
                         [NewConfig, AcceptTimeout, 
 
199
                          {Pid, ListenSocket}, Debug]},
 
200
            Restart   = permanent, 
 
201
            Shutdown  = infinity,
 
202
            Modules   = [httpd_instance_sup],
 
203
            Type      = supervisor,
 
204
            {Name, StartFunc, Restart, Shutdown, Type, Modules};
 
205
        {Pid, {error, Reason}}  ->
 
206
            exit(Pid, normal),
 
207
            {error, Reason}
 
208
    end.
201
209
                    
202
 
httpd_child_spec(Config, AcceptTimeout, Debug, Addr, Port) ->
 
210
httpd_child_spec_nolisten(Config, AcceptTimeout, Debug, Addr, Port) ->
203
211
    Name = {httpd_instance_sup, Addr, Port},
204
212
    StartFunc = {httpd_instance_sup, start_link,
205
213
                 [Config, AcceptTimeout, Debug]},
224
232
    SocketType = proplists:get_value(socket_type, Config, ip_comm), 
225
233
    case http_transport:start(SocketType) of
226
234
        ok ->
227
 
            case http_transport:listen(SocketType, Address, Port) of
 
235
            Fd = proplists:get_value(fd, Config), 
 
236
            case http_transport:listen(SocketType, Address, Port, Fd) of
228
237
                {ok, ListenSocket} ->
229
238
                    NewConfig = proplists:delete(port, Config),
230
239
                    {ok, NewPort} = inet:port(ListenSocket),