[erlang-questions] slave:pseudo/1,2 question

litao cheng litaocheng@REDACTED
Mon Nov 10 03:54:51 CET 2008


hi, buddy.
I have some questions about the slave:pseudo/1,2 function.
the doc says:
"A pseudo server is a server with a registered name which does absolutely
nothing but pass on all message to the real server which executes at a
master node. A pseudo server is an intermediary which only has the same
registered name as the real server. "
In my opinion, the pseudo server looks like a proxy, it transfers all the
message to the process on the master, the process registered with the same
name as the slave.

but in the slave.erl line 79, the code is :
relay1(Pid) ->
    receive
        X ->
            Pid ! X
    end,
    relay1(Pid).

the Pid is returned by rpc:call, so i think the message can't send to the
master.
the correct way is:
relay1(Name, Master) ->
    receive
        X ->
            {Name, Master} ! X
    end,
    relay1(Name, Master).

Is it right?

thanks!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20081110/d1c07738/attachment.htm>


More information about the erlang-questions mailing list