[erlang-questions] Registering a process with multiple names

Torben Hoffmann torben.lehoff@REDACTED
Thu Jan 22 11:04:43 CET 2009


Hi,

I have implemented a protocol stack and the current implementation has a
coordinator process that keeps track of the processes that are spawned to
handle the individual calls (very telcom protocol).

The reason for this is that I have two types of call identifies: one at the
top of the stack that represents my connection to our legacy system and one
at the bottom of the stack that represents the protocol's call.

When I get a message from our legacy system my coordinator process looks up
in its list of spawned processes and finds the process for that message
based on the legacy call identifier.

Likewise when I get a message from the protocol: the call identifier is used
by the coordinator to find the process to send the message to.

In my ideal world I would like to register the call process with two names:
one for the legacy call identificator and on for the protocol's call
identificator.
Then my coordinator could look up if a process has been spawned for a call
identificator (legacy or protocol) and then forward the message.
If there hasn't been spawned a process for the call the coordinator spawns a
new one and registers it.

The problem is that erlang:register/2 barfs if you try to register a process
more than once.

Surely I am not the first to run into this type of problem so I am hoping
that the someone has some ideas for me!

Thanks in advance,
Torben
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-questions/attachments/20090122/1e3439ec/attachment.htm>


More information about the erlang-questions mailing list