25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-10 16:58:46 +01:00

* src/tls/tls.erl: Accept {error,already_loaded} from

erl_ddll:load_driver/2
* src/stringprep/stringprep.erl: Likewise
* src/mod_irc/iconv.erl: Likewise
* src/ejabberd_app.erl: Likewise

SVN Revision: 427
This commit is contained in:
Alexey Shchepin 2005-10-25 02:19:01 +00:00
parent 1433dafe6b
commit 144f9f09e7
5 changed files with 30 additions and 6 deletions

View File

@ -1,5 +1,11 @@
2005-10-25 Alexey Shchepin <alexey@sevcom.net>
* src/tls/tls.erl: Accept {error,already_loaded} from
erl_ddll:load_driver/2
* src/stringprep/stringprep.erl: Likewise
* src/mod_irc/iconv.erl: Likewise
* src/ejabberd_app.erl: Likewise
* src/tls/tls_drv.c: Support for "connect" method
* src/tls/tls.erl: Likewise

View File

@ -63,7 +63,10 @@ init() ->
end,
error_logger:add_report_handler(ejabberd_logger_h, LogPath),
erl_ddll:load_driver(ejabberd:get_so_path(), tls_drv),
ok = erl_ddll:load_driver(ejabberd:get_so_path(), expat_erl),
case erl_ddll:load_driver(ejabberd:get_so_path(), expat_erl) of
ok -> ok;
{error, already_loaded} -> ok
end,
Port = open_port({spawn, expat_erl}, [binary]),
loop(Port).

View File

@ -31,7 +31,10 @@ start_link() ->
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
init([]) ->
ok = erl_ddll:load_driver(ejabberd:get_so_path(), iconv_erl),
case erl_ddll:load_driver(ejabberd:get_so_path(), iconv_erl) of
ok -> ok;
{error, already_loaded} -> ok
end,
Port = open_port({spawn, iconv_erl}, []),
ets:new(iconv_table, [set, public, named_table]),
ets:insert(iconv_table, {port, Port}),

View File

@ -39,7 +39,10 @@ start_link() ->
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
init([]) ->
ok = erl_ddll:load_driver(ejabberd:get_so_path(), stringprep_drv),
case erl_ddll:load_driver(ejabberd:get_so_path(), stringprep_drv) of
ok -> ok;
{error, already_loaded} -> ok
end,
Port = open_port({spawn, stringprep_drv}, []),
register(?STRINGPREP_PORT, Port),
{ok, Port}.

View File

@ -43,7 +43,10 @@ start_link() ->
gen_server:start_link({local, ?MODULE}, ?MODULE, [], []).
init([]) ->
ok = erl_ddll:load_driver(ejabberd:get_so_path(), tls_drv),
case erl_ddll:load_driver(ejabberd:get_so_path(), tls_drv) of
ok -> ok;
{error, already_loaded} -> ok
end,
Port = open_port({spawn, tls_drv}, [binary]),
Res = port_control(Port, ?SET_CERTIFICATE_FILE_ACCEPT, "./ssl.pem" ++ [0]),
case Res of
@ -85,7 +88,10 @@ terminate(_Reason, Port) ->
tcp_to_tls(TCPSocket, Options) ->
case lists:keysearch(certfile, 1, Options) of
{value, {certfile, CertFile}} ->
ok = erl_ddll:load_driver(ejabberd:get_so_path(), tls_drv),
case erl_ddll:load_driver(ejabberd:get_so_path(), tls_drv) of
ok -> ok;
{error, already_loaded} -> ok
end,
Port = open_port({spawn, tls_drv}, [binary]),
Command = case lists:member(connect, Options) of
true ->
@ -164,7 +170,10 @@ close(#tlssock{tcpsock = TCPSocket, tlsport = Port}) ->
test() ->
ok = erl_ddll:load_driver(ejabberd:get_so_path(), tls_drv),
case erl_ddll:load_driver(ejabberd:get_so_path(), tls_drv) of
ok -> ok;
{error, already_loaded} -> ok
end,
Port = open_port({spawn, tls_drv}, [binary]),
io:format("open_port: ~p~n", [Port]),
PCRes = port_control(Port, ?SET_CERTIFICATE_FILE_ACCEPT,