• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

processone / ejabberd / 1296

19 Jan 2026 11:25AM UTC coverage: 33.562% (+0.09%) from 33.468%
1296

push

github

badlop
mod_conversejs: Cosmetic change: sort paths alphabetically

0 of 4 new or added lines in 1 file covered. (0.0%)

11245 existing lines in 174 files now uncovered.

15580 of 46421 relevant lines covered (33.56%)

1074.56 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

31.58
/src/extauth_sup.erl
1
%%%-------------------------------------------------------------------
2
%%% Created : 7 May 2018 by Evgeny Khramtsov <ekhramtsov@process-one.net>
3
%%%
4
%%%
5
%%% ejabberd, Copyright (C) 2002-2026   ProcessOne
6
%%%
7
%%% This program is free software; you can redistribute it and/or
8
%%% modify it under the terms of the GNU General Public License as
9
%%% published by the Free Software Foundation; either version 2 of the
10
%%% License, or (at your option) any later version.
11
%%%
12
%%% This program is distributed in the hope that it will be useful,
13
%%% but WITHOUT ANY WARRANTY; without even the implied warranty of
14
%%% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15
%%% General Public License for more details.
16
%%%
17
%%% You should have received a copy of the GNU General Public License along
18
%%% with this program; if not, write to the Free Software Foundation, Inc.,
19
%%% 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20
%%%
21
%%%-------------------------------------------------------------------
22
-module(extauth_sup).
23
-behaviour(supervisor).
24

25
%% API
26
-export([start/1, stop/1, reload/1, start_link/3]).
27
%% Supervisor callbacks
28
-export([init/1]).
29

30
-include("logger.hrl").
31

32
%%%===================================================================
33
%%% API functions
34
%%%===================================================================
35
start(Host) ->
36
    case extauth:prog_name(Host) of
1✔
37
        undefined ->
38
            ?ERROR_MSG("Option 'extauth_program' is not set for '~ts'",
×
39
                       [Host]),
×
40
            ignore;
×
41
        Prog ->
42
            Pool = extauth:pool_name(Host),
1✔
43
            ChildSpec = {Pool, {?MODULE, start_link, [Host, Prog, Pool]},
1✔
44
                         permanent, infinity, supervisor, [?MODULE]},
45
            supervisor:start_child(ejabberd_backend_sup, ChildSpec)
1✔
46
    end.
47

48
stop(Host) ->
49
    Pool = extauth:pool_name(Host),
×
50
    supervisor:terminate_child(ejabberd_backend_sup, Pool),
×
51
    supervisor:delete_child(ejabberd_backend_sup, Pool).
×
52

53
reload(Host) ->
UNCOV
54
    Pool = extauth:pool_name(Host),
×
UNCOV
55
    Prog = extauth:prog_name(Host),
×
UNCOV
56
    PoolSize = extauth:pool_size(Host),
×
UNCOV
57
    try process_info(whereis(Pool), dictionary) of
×
58
        {dictionary, Dict} ->
UNCOV
59
            case proplists:get_value(extauth_program, Dict) of
×
60
                Prog ->
UNCOV
61
                    OldPoolSize = try supervisor:which_children(Pool) of
×
UNCOV
62
                                      Children -> length(Children)
×
63
                                  catch _:_ -> PoolSize
×
64
                                  end,
UNCOV
65
                    if OldPoolSize > PoolSize ->
×
66
                            lists:foreach(
×
67
                              fun(I) ->
68
                                      Worker = extauth:worker_name(Pool, I),
×
69
                                      supervisor:terminate_child(Pool, Worker),
×
70
                                      supervisor:delete_child(Pool, Worker)
×
71
                              end, lists:seq(PoolSize+1, OldPoolSize));
72
                       OldPoolSize < PoolSize ->
73
                            lists:foreach(
×
74
                              fun(I) ->
75
                                      Spec = worker_spec(Pool, Prog, I),
×
76
                                      supervisor:start_child(Pool, Spec)
×
77
                              end, lists:seq(OldPoolSize+1, PoolSize));
78
                       OldPoolSize == PoolSize ->
UNCOV
79
                            ok
×
80
                    end;
81
                _ ->
82
                    stop(Host),
×
83
                    start(Host)
×
84
            end
85
    catch _:badarg ->
86
            ok
×
87
    end.
88

89
start_link(Host, Prog, Pool) ->
90
    supervisor:start_link({local, Pool}, ?MODULE, [Host, Prog, Pool]).
1✔
91

92
%%%===================================================================
93
%%% Supervisor callbacks
94
%%%===================================================================
95
init([Host, Prog, Pool]) ->
96
    PoolSize = extauth:pool_size(Host),
1✔
97
    Children = lists:map(
1✔
98
                 fun(I) ->
99
                         worker_spec(Pool, Prog, I)
4✔
100
                 end, lists:seq(1, PoolSize)),
101
    put(extauth_program, Prog),
1✔
102
    {ok, {{one_for_one, PoolSize, 1}, Children}}.
1✔
103

104
%%%===================================================================
105
%%% Internal functions
106
%%%===================================================================
107
worker_spec(Pool, Prog, I) ->
108
    Worker = extauth:worker_name(Pool, I),
4✔
109
    {Worker, {extauth, start_link, [Worker, Prog]},
4✔
110
     permanent, 5000, worker, [extauth]}.
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc