* 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.

SVN Revision: 72
This commit is contained in:
Alexey Shchepin 2003-02-13 19:39:13 +00:00
parent d57c147626
commit 741ff3cc75
4 changed files with 54 additions and 12 deletions

View File

@ -1,3 +1,11 @@
2003-02-13 Alexey Shchepin <alexey@sevcom.net>
* 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 <alexey@sevcom.net> 2003-02-11 Alexey Shchepin <alexey@sevcom.net>
* (all): Version 0.1-alpha released * (all): Version 0.1-alpha released

12
TODO
View File

@ -1,14 +1,20 @@
admin interface admin interface
users management users management
statistics about each user
statistics about each connection
node management node management
node restart/shutdown
statistics about memory usage
backup management backup management
S2S timeouts S2S timeouts
rewrite S2S key validation rewrite S2S key validation
iq:browse (?) iq:browse (?)
more correctly work with SRV DNS records (priority, weight, etc...) more correctly work with SRV DNS records (priority, weight, etc...)
karma
SSL SSL
SASL SASL
JEP-62,63 (?) JEP-62,63 (?)
make roster set to work in one transaction 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

View File

@ -364,6 +364,7 @@ terminate(Reason, StateName, StateData) ->
presence_broadcast(From, StateData#state.pres_a, Packet), presence_broadcast(From, StateData#state.pres_a, Packet),
presence_broadcast(From, StateData#state.pres_i, Packet) presence_broadcast(From, StateData#state.pres_i, Packet)
end, end,
gen_tcp:close(StateData#state.socket),
ok. ok.
%%%---------------------------------------------------------------------- %%%----------------------------------------------------------------------

View File

@ -12,6 +12,7 @@
-behaviour(gen_mod). -behaviour(gen_mod).
-export([start/1, -export([start/1,
init/0,
stop/0, stop/0,
store_packet/3, store_packet/3,
resend_offline_messages/1, resend_offline_messages/1,
@ -21,12 +22,41 @@
-record(offline_msg, {user, timestamp, from, to, packet}). -record(offline_msg, {user, timestamp, from, to, packet}).
-define(PROCNAME, ejabberd_offline).
start(_) -> start(_) ->
mnesia:create_table(offline_msg, mnesia:create_table(offline_msg,
[{disc_only_copies, [node()]}, [{disc_only_copies, [node()]},
{type, bag}, {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() -> stop() ->
% TODO: maybe throw error that this module can't be removed? % TODO: maybe throw error that this module can't be removed?
@ -38,14 +68,11 @@ store_packet(From, To, Packet) ->
{User, Server, Resource} = To, {User, Server, Resource} = To,
LUser = jlib:tolower(User), LUser = jlib:tolower(User),
TimeStamp = now(), TimeStamp = now(),
F = fun() -> ?PROCNAME ! #offline_msg{user = LUser,
mnesia:write(#offline_msg{user = LUser, timestamp = TimeStamp,
timestamp = TimeStamp, from = From,
from = From, to = To,
to = To, packet = Packet};
packet = Packet})
end,
mnesia:transaction(F);
_ -> _ ->
ok ok
end. end.