]> granicus.if.org Git - ejabberd/commitdiff
Changed the place where database is created(thanks to Michael Remond)
authorBadlop <badlop@process-one.net>
Tue, 16 Jun 2009 17:47:47 +0000 (17:47 +0000)
committerBadlop <badlop@process-one.net>
Tue, 16 Jun 2009 17:47:47 +0000 (17:47 +0000)
SVN Revision: 2249

src/web/ejabberd_http_bind.erl
src/web/mod_http_bind.erl

index cdb8ecac978c3273a0534463b1b49b46c6ff00c2..e55b840cb073e0787081898c28ad1f48e7d5d6ba 100644 (file)
@@ -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.
index 0e238f1f724ff67a976fe6a77bf5a90ab1423853..68688e328b48cb4ceb83da3a35e9230ae9ec8376 100644 (file)
@@ -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.