* src/ejabberd_s2s_out.erl: Close connection after key

verification

* src/ejabberd_c2s.erl: start replaced with start_link
* src/ejabberd_s2s_in.erl: Likewise
* src/ejabberd_s2s_out.erl: Likewise
* src/ejabberd_service.erl: Likewise

* src/ejabberd_listener.erl: Now uses proc_lib to spawn listeners,
removed 3rd parameter in listener configuration (assumed to equal
start_link)

* src/ejabberd.rel: Updated

* doc/guide.tex: Small changes

* doc/Makefile: Added implicit charset specification to hevea

SVN Revision: 124
This commit is contained in:
Alexey Shchepin 2003-07-14 18:06:03 +00:00
parent 3131c08155
commit 1834fb3a72
10 changed files with 78 additions and 56 deletions

View File

@ -1,3 +1,23 @@
2003-07-14 Alexey Shchepin <alexey@sevcom.net>
* src/ejabberd_s2s_out.erl: Close connection after key
verification
* src/ejabberd_c2s.erl: start replaced with start_link
* src/ejabberd_s2s_in.erl: Likewise
* src/ejabberd_s2s_out.erl: Likewise
* src/ejabberd_service.erl: Likewise
* src/ejabberd_listener.erl: Now uses proc_lib to spawn listeners,
removed 3rd parameter in listener configuration (assumed to equal
start_link)
* src/ejabberd.rel: Updated
* doc/guide.tex: Small changes
* doc/Makefile: Added implicit charset specification to hevea
2003-07-12 Alexey Shchepin <alexey@sevcom.net>
* doc/guide.tex: Updated (thanks to Sergei Golovan)

View File

@ -3,11 +3,11 @@
<HTML>
<HEAD><TITLE>Ejabberd Installation and Operation Guide</TITLE>
<META http-equiv="Content-Type" content="text/html; charset=KOI8-R">
<META http-equiv="Content-Type" content="text/html; charset=ISO8859-1">
<META name="GENERATOR" content="hevea 1.06">
</HEAD>
<BODY >
<!--HEVEA command line is: /usr/bin/hevea guide.tex -->
<!--HEVEA command line is: /usr/bin/hevea -charset ISO8859-1 guide.tex -->
<!--HTMLHEAD-->
<!--ENDHTML-->
<!--PREFIX <ARG ></ARG>-->
@ -115,9 +115,9 @@ The main features of <TT>ejabberd</TT> is:
<UL><LI>
Works on most of popular platforms: *nix (tested on Linux and FreeBSD)
and Win32
<LI>Distributed: You may run <TT>ejabberd</TT> on a cluster of machines and all of
<LI>Distributed: You can run <TT>ejabberd</TT> on a cluster of machines and all of
them will serve one Jabber domain.
<LI>Fault-tolerance: You may setup an <TT>ejabberd</TT> cluster so that all the
<LI>Fault-tolerance: You can setup an <TT>ejabberd</TT> cluster so that all the
information required for a properly working service will be stored
permanently on more than one node. This means that if one of the nodes
crashes, then the others will continue working without disruption.
@ -211,8 +211,9 @@ TBD<BR>
<OL type=1><LI>
Install Erlang emulator (for example, into <CODE>C:\Program Files\erl5.1.2</CODE>).
<LI>Install Expat library into <CODE>C:\Program Files\Expat-1.95.6</CODE>
directory. Copy file <CODE>C:\Program Files\Expat-1.95.6\Libs\libexpat.dll</CODE> to your Windows system directory (for
example, <CODE>C:\WINNT</CODE> or <CODE>C:\WINNT\System32</CODE>)
directory. Copy file <CODE>C:\Program Files\Expat-1.95.6\Libs\libexpat.dll</CODE>
to your Windows system directory (for example, <CODE>C:\WINNT</CODE> or
<CODE>C:\WINNT\System32</CODE>)
<LI>Install Iconv library into <CODE>C:\Program Files\GnuWin32</CODE> directory.
Copy file <CODE>C:\Program Files\GnuWin32\bin\libiconv-2.dll</CODE> to your
Windows system directory.<BR>
@ -236,6 +237,11 @@ nmake -f Makefile.win32
werl -s ejabberd -name ejabberd
</PRE><LI>Enjoy!
</OL>
Some recent versions of Erlang distribution it seems have bug in crypto
application, so ejabberd could be built but users can't use digest
authentication (only plain-text). Also it seems SSL support is broken in
Windows distribution of Erlang emulator.<BR>
<BR>
<!--TOC subsection Starting-->
<H3><A NAME="htoc10">2.4</A>&nbsp;&nbsp;Starting</H3><!--SEC END -->

View File

@ -64,9 +64,9 @@ The main features of \ejabberd{} is:
\begin{itemize}
\item Works on most of popular platforms: *nix (tested on Linux and FreeBSD)
and Win32
\item Distributed: You may run \ejabberd{} on a cluster of machines and all of
\item Distributed: You can run \ejabberd{} on a cluster of machines and all of
them will serve one Jabber domain.
\item Fault-tolerance: You may setup an \ejabberd{} cluster so that all the
\item Fault-tolerance: You can setup an \ejabberd{} cluster so that all the
information required for a properly working service will be stored
permanently on more than one node. This means that if one of the nodes
crashes, then the others will continue working without disruption.

View File

@ -38,13 +38,14 @@
{host, "e.localhost"}.
{listen, [{5522, ejabberd_c2s, start, [{access, c2s},
{shaper, c2s_shaper}]},
{5523, ejabberd_c2s, start,
[{access, c2s}, {ssl, [{certfile, "./ssl.pem"}]}]},
{5269, ejabberd_s2s_in, start, []},
{8888, ejabberd_service, start,
[{host, "conference.e.localhost", [{password, "asdqwe"}]}]}
{listen, [{5522, ejabberd_c2s, [{access, c2s},
{shaper, c2s_shaper}]},
{5523, ejabberd_c2s, [{access, c2s},
{ssl, [{certfile, "./ssl.pem"}]}]},
{5269, ejabberd_s2s_in, []},
{8888, ejabberd_service, [{host,
"conference.e.localhost",
[{password, "asdqwe"}]}]}
]}.
% This value (5569) is only for debugging, must be 5269

View File

@ -13,7 +13,7 @@
-behaviour(gen_fsm).
%% External exports
-export([start/2, receiver/4, send_text/2, send_element/2]).
-export([start_link/2, receiver/4, send_text/2, send_element/2]).
%% gen_fsm callbacks
-export([init/1,
@ -77,8 +77,8 @@
%%%----------------------------------------------------------------------
%%% API
%%%----------------------------------------------------------------------
start(SockData, Opts) ->
gen_fsm:start(ejabberd_c2s, [SockData, Opts], ?FSMOPTS).
start_link(SockData, Opts) ->
gen_fsm:start_link(ejabberd_c2s, [SockData, Opts], ?FSMOPTS).
%%%----------------------------------------------------------------------
%%% Callback functions from gen_fsm

View File

@ -10,9 +10,9 @@
-author('alexey@sevcom.net').
-vsn('$Revision$ ').
-export([start_link/0, init/1, start/4,
init/4,
init_ssl/5
-export([start_link/0, init/1, start/3,
init/3,
init_ssl/4
]).
start_link() ->
@ -26,9 +26,9 @@ init(_) ->
Ls ->
{ok, {{one_for_one, 10, 1},
lists:map(
fun({Port, Module, Fun, Opts}) ->
fun({Port, Module, Opts}) ->
{Port,
{?MODULE, start, [Port, Module, Fun, Opts]},
{?MODULE, start, [Port, Module, Opts]},
permanent,
brutal_kill,
worker,
@ -37,32 +37,32 @@ init(_) ->
end.
start(Port, Module, Fun, Opts) ->
start(Port, Module, Opts) ->
case lists:keysearch(ssl, 1, Opts) of
{value, {ssl, SSLOpts}} ->
{ok, spawn_link(?MODULE, init_ssl,
[Port, Module, Fun, Opts, SSLOpts])};
{ok, proc_lib:spawn_link(?MODULE, init_ssl,
[Port, Module, Opts, SSLOpts])};
_ ->
{ok, spawn_link(?MODULE, init, [Port, Module, Fun, Opts])}
{ok, proc_lib:spawn_link(?MODULE, init, [Port, Module, Opts])}
end.
init(Port, Module, Fun, Opts) ->
init(Port, Module, Opts) ->
{ok, ListenSocket} = gen_tcp:listen(Port, [binary,
{packet, 0},
{active, false},
{reuseaddr, true}]),
accept(ListenSocket, Module, Fun, Opts).
accept(ListenSocket, Module, Opts).
accept(ListenSocket, Module, Fun, Opts) ->
accept(ListenSocket, Module, Opts) ->
case gen_tcp:accept(ListenSocket) of
{ok, Socket} ->
{ok, Pid} = apply(Module, Fun, [{gen_tcp, Socket}, Opts]),
{ok, Pid} = apply(Module, start_link, [{gen_tcp, Socket}, Opts]),
gen_tcp:controlling_process(Socket, Pid),
accept(ListenSocket, Module, Fun, Opts)
accept(ListenSocket, Module, Opts)
end.
init_ssl(Port, Module, Fun, Opts, SSLOpts) ->
init_ssl(Port, Module, Opts, SSLOpts) ->
{ok, ListenSocket} = ssl:listen(Port, [binary,
{packet, 0},
{active, false},
@ -70,13 +70,13 @@ init_ssl(Port, Module, Fun, Opts, SSLOpts) ->
{backlog, 0},
{cachetimout, 0} |
SSLOpts]),
accept_ssl(ListenSocket, Module, Fun, Opts).
accept_ssl(ListenSocket, Module, Opts).
accept_ssl(ListenSocket, Module, Fun, Opts) ->
accept_ssl(ListenSocket, Module, Opts) ->
case ssl:accept(ListenSocket) of
{ok, Socket} ->
apply(Module, Fun, [{ssl, Socket}, Opts]),
accept_ssl(ListenSocket, Module, Fun, Opts)
apply(Module, start_link, [{ssl, Socket}, Opts]),
accept_ssl(ListenSocket, Module, Opts)
end.

View File

@ -168,7 +168,7 @@ do_route(From, To, Packet) ->
ok;
{atomic, new} ->
?DEBUG("starting new s2s connection~n", []),
Pid = ejabberd_s2s_out:start(MyServer, Server, {new, Key}),
Pid = ejabberd_s2s_out:start_link(MyServer, Server, {new, Key}),
mnesia:transaction(fun() ->
mnesia:write(#local_s2s{fromto = FromTo,
pid = Pid})

View File

@ -13,7 +13,7 @@
-behaviour(gen_fsm).
%% External exports
-export([start/2, receiver/2, send_text/2, send_element/2]).
-export([start_link/2, receiver/2, send_text/2, send_element/2]).
%% gen_fsm callbacks
-export([init/1,
@ -63,8 +63,8 @@
%%%----------------------------------------------------------------------
%%% API
%%%----------------------------------------------------------------------
start(SockData, Opts) ->
gen_fsm:start(ejabberd_s2s_in, [SockData], ?FSMOPTS).
start_link(SockData, Opts) ->
gen_fsm:start_link(ejabberd_s2s_in, [SockData], ?FSMOPTS).
%%%----------------------------------------------------------------------
%%% Callback functions from gen_fsm
@ -134,8 +134,8 @@ wait_for_key({xmlstreamelement, El}, StateData) ->
?INFO_MSG("GET KEY: ~p", [{To, From, Id, Key}]),
case lists:member(To, ejabberd_router:dirty_get_all_domains()) of
true ->
ejabberd_s2s_out:start(To, From,
{verify, self(), Key}),
ejabberd_s2s_out:start_link(To, From,
{verify, self(), Key}),
{next_state,
wait_for_verification,
StateData#state{myname = To,

View File

@ -13,7 +13,7 @@
-behaviour(gen_fsm).
%% External exports
-export([start/3, send_text/2, send_element/2]).
-export([start_link/3, send_text/2, send_element/2]).
%% gen_fsm callbacks
-export([init/1,
@ -65,8 +65,9 @@
%%%----------------------------------------------------------------------
%%% API
%%%----------------------------------------------------------------------
start(From, Host, Type) ->
{ok, Pid} = gen_fsm:start(ejabberd_s2s_out, [From, Host, Type], ?FSMOPTS),
start_link(From, Host, Type) ->
{ok, Pid} = gen_fsm:start_link(ejabberd_s2s_out, [From, Host, Type],
?FSMOPTS),
Pid.
%%%----------------------------------------------------------------------
@ -212,13 +213,7 @@ wait_for_validation({xmlstreamelement, El}, StateData) ->
_ ->
gen_fsm:send_event(Pid, invalid)
end,
case StateData#state.verify of
false ->
{stop, normal, StateData};
_ ->
{next_state, wait_for_validation,
StateData#state{verify = false}, ?S2STIMEOUT}
end
{stop, normal, StateData}
end;
_ ->
{next_state, wait_for_validation, StateData, ?S2STIMEOUT}

View File

@ -13,7 +13,7 @@
-behaviour(gen_fsm).
%% External exports
-export([start/2, receiver/2, send_text/2, send_element/2]).
-export([start_link/2, receiver/2, send_text/2, send_element/2]).
%% gen_fsm callbacks
-export([init/1,
@ -69,8 +69,8 @@
%%%----------------------------------------------------------------------
%%% API
%%%----------------------------------------------------------------------
start(SockData, Opts) ->
gen_fsm:start(ejabberd_service, [SockData, Opts], ?FSMOPTS).
start_link(SockData, Opts) ->
gen_fsm:start_link(ejabberd_service, [SockData, Opts], ?FSMOPTS).
%%%----------------------------------------------------------------------
%%% Callback functions from gen_fsm