25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-11-22 16:20:52 +01:00

* 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>
* (all): Version 0.1-alpha released

12
TODO
View File

@ -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

View File

@ -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.
%%%----------------------------------------------------------------------

View File

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