diff --git a/ChangeLog b/ChangeLog index 3c729f20a..7e1f515dd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +2003-02-13 Alexey Shchepin + + * src/ejabberd_c2s.erl: Bugfix: close socket when stream is closed + + * src/mod_offline.erl: Now all offline packets processed in + separate queue to avoid delaying of other packets transmission. + Also all packets in queue processed in one transaction. + 2003-02-11 Alexey Shchepin * (all): Version 0.1-alpha released diff --git a/TODO b/TODO index d9c80fd9e..0f202549d 100644 --- a/TODO +++ b/TODO @@ -1,14 +1,20 @@ admin interface users management + statistics about each user + statistics about each connection node management + node restart/shutdown + statistics about memory usage backup management S2S timeouts rewrite S2S key validation iq:browse (?) -more correctly work with SRV DNS records (priority, weight, etc...) -karma +more correctly work with SRV DNS records (priority, weight, etc...) SSL SASL JEP-62,63 (?) make roster set to work in one transaction - +add traffic shapers to to c2s connection before authentification +add traffic shapers to s2s connections +more traffic shapers +SNMP diff --git a/src/ejabberd_c2s.erl b/src/ejabberd_c2s.erl index 777bcc28b..f5b722e32 100644 --- a/src/ejabberd_c2s.erl +++ b/src/ejabberd_c2s.erl @@ -364,6 +364,7 @@ terminate(Reason, StateName, StateData) -> presence_broadcast(From, StateData#state.pres_a, Packet), presence_broadcast(From, StateData#state.pres_i, Packet) end, + gen_tcp:close(StateData#state.socket), ok. %%%---------------------------------------------------------------------- diff --git a/src/mod_offline.erl b/src/mod_offline.erl index e5a54a3b7..eab2d1ba8 100644 --- a/src/mod_offline.erl +++ b/src/mod_offline.erl @@ -12,6 +12,7 @@ -behaviour(gen_mod). -export([start/1, + init/0, stop/0, store_packet/3, resend_offline_messages/1, @@ -21,12 +22,41 @@ -record(offline_msg, {user, timestamp, from, to, packet}). +-define(PROCNAME, ejabberd_offline). start(_) -> mnesia:create_table(offline_msg, [{disc_only_copies, [node()]}, {type, bag}, - {attributes, record_info(fields, offline_msg)}]). + {attributes, record_info(fields, offline_msg)}]), + register(?PROCNAME, spawn(?MODULE, init, [])). + +init() -> + loop(). + +loop() -> + receive + #offline_msg{} = Msg -> + Msgs = receive_all([Msg]), + F = fun() -> + lists:foreach(fun(M) -> + mnesia:write(M) + end, Msgs) + end, + mnesia:transaction(F), + loop(); + _ -> + loop() + end. + +receive_all(Msgs) -> + receive + #offline_msg{} = Msg -> + receive_all([Msg | Msgs]) + after 0 -> + Msgs + end. + stop() -> % TODO: maybe throw error that this module can't be removed? @@ -38,14 +68,11 @@ store_packet(From, To, Packet) -> {User, Server, Resource} = To, LUser = jlib:tolower(User), TimeStamp = now(), - F = fun() -> - mnesia:write(#offline_msg{user = LUser, - timestamp = TimeStamp, - from = From, - to = To, - packet = Packet}) - end, - mnesia:transaction(F); + ?PROCNAME ! #offline_msg{user = LUser, + timestamp = TimeStamp, + from = From, + to = To, + packet = Packet}; _ -> ok end.