[erlang-questions] Questions about lib_chan and IRC Lite (other than the one had been asked before).

lang qiu qiulang@REDACTED
Wed Jan 14 10:51:23 CET 2009

Hi all,

Nobody replies my question about IRC Lite, so I ask it the second time
(Change the title in hoping that it may cause some attention). And I notice
that someone asked about some other questions about IRC Lite before, which
may suggest this example is tricky.

So my here is my question, if a process sends another process several
messages *in a row* while in the receiving process when it processes the
first message, it does that in its own receiving loop, then all the
remaining message the first process sends goes into this loop and this may
against the purpose.

My words may sound nonsense. So check these codes,

In the chat_client.erl,

try_to_connect(Parent, Host, Port, Pwd) ->
        Parent ! {*connected, MM*},

While in parent *disconnected/3*,
    {*connected, MM*} ->
        lib_chan_mm:send(MM, {login, Group, Nick}),
        *wait_login_response*(Widget, MM);
     {*'EXIT', _Pid, _Reason*} -> %% if we add this clause here
*wait_login_response/2* defines,
     Other ->
        io:format("chat_client login unexpected:~p~p~n",[Other,MM]),

The result shows that wait_login_response/2 receives try_to_connect's 'EXIT'
message not disconnected/3. I further test that if try_to_connect sends more
messages after {*connected, MM*} , they will all be received by
wait_login_response instead of disconnected/3 even there are match patterns
in disconnected/3 (Correct me if I am wrong). But this may not be a good
idea. Maybe it is better to let disconnected/3 processes the 'EXIT' message
instead of wait_login_response/2 (because it should only deal with the login
related message). So how do we fix this problem ?  Or I miss something here


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090114/3dc40cea/attachment.htm>

More information about the erlang-questions mailing list