aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2009-06-16 17:47:47 +0000
committerBadlop <badlop@process-one.net>2009-06-16 17:47:47 +0000
commit20060d9cf60de399c3cc6fa7fa6963e57bd538ce (patch)
treeaebf6ba34a031312299a997ac7f14c7a6a59d2c5
parentFix remote-stream-error stanzas (diff)
Changed the place where database is created(thanks to Michael Remond)
SVN Revision: 2249
-rw-r--r--src/web/ejabberd_http_bind.erl19
-rw-r--r--src/web/mod_http_bind.erl22
2 files changed, 22 insertions, 19 deletions
diff --git a/src/web/ejabberd_http_bind.erl b/src/web/ejabberd_http_bind.erl
index cdb8ecac9..e55b840cb 100644
--- a/src/web/ejabberd_http_bind.erl
+++ b/src/web/ejabberd_http_bind.erl
@@ -4,7 +4,7 @@
%%% Purpose : Implements XMPP over BOSH (XEP-0205) (formerly known as
%%% HTTP Binding)
%%% Created : 21 Sep 2005 by Stefan Strigler <steve@zeank.in-berlin.de>
-%%% Id : $Id: ejabberd_http_bind.erl 917 2009-03-13 16:27:30Z badlop $
+%%% Id : $Id: ejabberd_http_bind.erl 942 2009-04-22 15:25:31Z mremond $
%%%----------------------------------------------------------------------
-module(ejabberd_http_bind).
@@ -95,7 +95,6 @@
%%% API
%%%----------------------------------------------------------------------
start(Sid, Key, IP) ->
- setup_database(),
supervisor:start_child(ejabberd_http_bind_sup, [Sid, Key, IP]).
start_link(Sid, Key, IP) ->
@@ -1110,19 +1109,3 @@ check_default_xmlns({xmlelement, Name, Attrs, Els} = El) ->
true ->
El
end.
-
-setup_database() ->
- migrate_database(),
- mnesia:create_table(http_bind,
- [{ram_copies, [node()]},
- {attributes, record_info(fields, http_bind)}]).
-
-migrate_database() ->
- case catch mnesia:table_info(http_bind, attributes) of
- [id, pid, to, hold, wait, version] ->
- ok;
- _ ->
- %% Since the stored information is not important, instead
- %% of actually migrating data, let's just destroy the table
- mnesia:delete_table(http_bind)
- end.
diff --git a/src/web/mod_http_bind.erl b/src/web/mod_http_bind.erl
index 0e238f1f7..68688e328 100644
--- a/src/web/mod_http_bind.erl
+++ b/src/web/mod_http_bind.erl
@@ -3,7 +3,7 @@
%%% Author : Stefan Strigler <steve@zeank.in-berlin.de>
%%% Purpose : Implementation of XMPP over BOSH (XEP-0206)
%%% Created : Tue Feb 20 13:15:52 CET 2007
-%%% Id : $Id: mod_http_bind.erl 856 2009-01-13 17:11:02Z badlop $
+%%% Id : $Id: mod_http_bind.erl 942 2009-04-22 15:25:31Z mremond $
%%%----------------------------------------------------------------------
%%%----------------------------------------------------------------------
@@ -31,6 +31,9 @@
-include("jlib.hrl").
-include("ejabberd_http.hrl").
+%% Duplicated from ejabberd_http_bind.
+%% TODO: move to hrl file.
+-record(http_bind, {id, pid, to, hold, wait, version}).
%%%----------------------------------------------------------------------
%%% API
@@ -69,6 +72,7 @@ process(_Path, _Request) ->
%%% BEHAVIOUR CALLBACKS
%%%----------------------------------------------------------------------
start(_Host, _Opts) ->
+ setup_database(),
HTTPBindSupervisor =
{ejabberd_http_bind_sup,
{ejabberd_tmp_sup, start_link,
@@ -96,3 +100,19 @@ stop(_Host) ->
{error, Error} ->
{'EXIT', {terminate_child_error, Error}}
end.
+
+setup_database() ->
+ migrate_database(),
+ mnesia:create_table(http_bind,
+ [{ram_copies, [node()]},
+ {attributes, record_info(fields, http_bind)}]).
+
+migrate_database() ->
+ case catch mnesia:table_info(http_bind, attributes) of
+ [id, pid, to, hold, wait, version] ->
+ ok;
+ _ ->
+ %% Since the stored information is not important, instead
+ %% of actually migrating data, let's just destroy the table
+ mnesia:delete_table(http_bind)
+ end.