diff options
author | Hubert Plociniczak <hubert@lshift.net> | 2008-10-24 11:06:10 +0100 |
---|---|---|
committer | Hubert Plociniczak <hubert@lshift.net> | 2008-10-24 11:06:10 +0100 |
commit | 750f2903d97c28beaf0dec44d2d2396c899c80c9 (patch) | |
tree | c2be2e6f50f1089db1639d3a4b5771f01a25bb10 | |
parent | f33cb897696f36fe3de419a56473250244b21ffd (diff) | |
parent | 8f25f029db6fe8a2d498db4c91295f8a0aa8e78f (diff) | |
download | rabbitmq-server-750f2903d97c28beaf0dec44d2d2396c899c80c9.tar.gz |
Merge bug19552 into default
-rw-r--r-- | src/buffering_proxy.erl | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/src/buffering_proxy.erl b/src/buffering_proxy.erl index d2505701..dc168608 100644 --- a/src/buffering_proxy.erl +++ b/src/buffering_proxy.erl @@ -40,7 +40,8 @@ start_link(M, A) -> ProxyPid = self(), Ref = make_ref(), Pid = spawn_link( - fun () -> mainloop(ProxyPid, Ref, M, + fun () -> ProxyPid ! Ref, + mainloop(ProxyPid, Ref, M, M:init(ProxyPid, A)) end), proxy_loop(Ref, Pid, empty) end). @@ -48,13 +49,15 @@ start_link(M, A) -> %%---------------------------------------------------------------------------- mainloop(ProxyPid, Ref, M, State) -> - ProxyPid ! Ref, NewState = receive {Ref, Messages} -> - lists:foldl(fun (Msg, S) -> - drain(M, M:handle_message(Msg, S)) - end, State, lists:reverse(Messages)); + NewSt = + lists:foldl(fun (Msg, S) -> + drain(M, M:handle_message(Msg, S)) + end, State, lists:reverse(Messages)), + ProxyPid ! Ref, + NewSt; Msg -> M:handle_message(Msg, State) end, ?MODULE:mainloop(ProxyPid, Ref, M, NewState). |