25
1
mirror of https://github.com/processone/ejabberd.git synced 2024-12-26 17:38:45 +01:00

Forward old messages to newly spawned extauth process (thanks to Mika Seppänen)(EJAB-1385)

This commit is contained in:
Badlop 2011-02-21 16:13:41 +01:00
parent 1c89914382
commit 850218c2df

View File

@ -126,7 +126,8 @@ loop(Port, Timeout, ProcessName, ExtPrg) ->
?ERROR_MSG("extauth call '~p' didn't receive response", [Msg]),
Caller ! {eauth, false},
unregister(ProcessName),
spawn(?MODULE, init, [ProcessName, ExtPrg]),
Pid = spawn(?MODULE, init, [ProcessName, ExtPrg]),
flush_buffer_and_forward_messages(Pid),
exit(port_terminated)
end;
stop ->
@ -140,6 +141,15 @@ loop(Port, Timeout, ProcessName, ExtPrg) ->
exit(port_terminated)
end.
flush_buffer_and_forward_messages(Pid) ->
receive
Message ->
Pid ! Message,
flush_buffer_and_forward_messages(Pid)
after 0 ->
true
end.
join(List, Sep) ->
lists:foldl(fun(A, "") -> A;
(A, Acc) -> Acc ++ Sep ++ A