From 94c690661bc8616e99caa5eec877787bcc063c30 Mon Sep 17 00:00:00 2001 From: Holger Weiss Date: Tue, 10 Mar 2015 01:54:36 +0100 Subject: [PATCH] mod_statsdx: Call table_name/1 with 'server' atom --- mod_statsdx/src/mod_statsdx.erl | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mod_statsdx/src/mod_statsdx.erl b/mod_statsdx/src/mod_statsdx.erl index 05ae811..fea3b08 100644 --- a/mod_statsdx/src/mod_statsdx.erl +++ b/mod_statsdx/src/mod_statsdx.erl @@ -110,7 +110,7 @@ loop(Hosts) -> %% Si no existe una tabla de stats del server, crearla. %% Deberia ser creada por un proceso que solo muera cuando se detenga el ultimo mod_statsdx del servidor prepare_stats_server(CD) -> - Table = table_name("server"), + Table = table_name(server), ets:new(Table, [named_table, public]), ets:insert(Table, {{user_login, server}, CD}), ets:insert(Table, {{user_logout, server}, CD}), @@ -191,7 +191,7 @@ finish_stats() -> ejabberd_hooks:delete(webadmin_menu_node, ?MODULE, web_menu_node, 50), ejabberd_hooks:delete(webadmin_page_main, ?MODULE, web_page_main, 50), ejabberd_hooks:delete(webadmin_page_node, ?MODULE, web_page_node, 50), - Table = table_name("server"), + Table = table_name(server), catch ets:delete(Table). finish_stats(Host) -> @@ -214,13 +214,13 @@ finish_stats(Host) -> register_user(_User, Host) -> TableHost = table_name(Host), - TableServer = table_name("server"), + TableServer = table_name(server), ets:update_counter(TableHost, {register_user, Host}, 1), ets:update_counter(TableServer, {register_user, server}, 1). remove_user(_User, Host) -> TableHost = table_name(Host), - TableServer = table_name("server"), + TableServer = table_name(server), ets:update_counter(TableHost, {remove_user, Host}, 1), ets:update_counter(TableServer, {remove_user, server}, 1). @@ -731,7 +731,7 @@ user_login(U) -> User = U#jid.luser, Host = U#jid.lserver, Resource = U#jid.lresource, - ets:update_counter(table_name("server"), {user_login, server}, 1), + ets:update_counter(table_name(server), {user_login, server}, 1), ets:update_counter(table_name(Host), {user_login, Host}, 1), request_iqversion(User, Host, Resource). @@ -742,7 +742,7 @@ user_logout_sm(_, JID, _Data) -> %% cuando un usuario desconecta, buscar en la tabla su JID/USR y quitarlo user_logout(User, Host, Resource, _Status) -> TableHost = table_name(Host), - TableServer = table_name("server"), + TableServer = table_name(server), ets:update_counter(TableServer, {user_logout, server}, 1), ets:update_counter(TableHost, {user_logout, Host}, 1), @@ -796,7 +796,7 @@ received_response(From, {xmlel, <<"iq">>, Attrs, Elc}) -> L -> binary_to_list(L) end, TableHost = table_name(Host), - TableServer = table_name("server"), + TableServer = table_name(server), update_counter_create(TableHost, {lang, Host, Lang}, 1), update_counter_create(TableServer, {lang, server, Lang}, 1), @@ -812,7 +812,7 @@ received_response(From, {xmlel, <<"iq">>, Attrs, Elc}) -> ConnType = get_connection_type(User, Host, Resource), TableHost = table_name(Host), - TableServer = table_name("server"), + TableServer = table_name(server), ets:update_counter(TableHost, {client, Host, Client_id}, 1), ets:update_counter(TableServer, {client, server, Client_id}, 1), ets:update_counter(TableHost, {os, Host, OS_id}, 1),