summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBadlop <badlop@process-one.net>2011-02-21 16:13:41 +0100
committerBadlop <badlop@process-one.net>2011-02-21 16:13:41 +0100
commit850218c2df808d9802d960f09c513896b6b06560 (patch)
tree570d368c1b4397b8e24983928cf5cea18a2bf327
parentNew route_iq/5 accepting Timeout (thanks to Edwin Fine)(EJAB-1398) (diff)
Forward old messages to newly spawned extauth process (thanks to Mika Seppänen)(EJAB-1385)
-rw-r--r--src/extauth.erl12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/extauth.erl b/src/extauth.erl
index c1721a0e..3b2e7db6 100644
--- a/src/extauth.erl
+++ b/src/extauth.erl
@@ -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