diff options
author | Vitaliy Batichko <[email protected]> | 2010-11-29 20:42:28 +0200 |
---|---|---|
committer | Vitaliy Batichko <[email protected]> | 2010-12-10 17:32:02 +0200 |
commit | 7992d6a6bfa0f460f8663c2d72d07b60755a4857 (patch) | |
tree | ad9ff808f00832c32ea84f8a447a8e106a99f3e5 /lib/erl_interface/src/legacy/global_register.c | |
parent | 95392e693e210189df82173c9bcd345b58b004fe (diff) | |
download | otp-7992d6a6bfa0f460f8663c2d72d07b60755a4857.tar.gz otp-7992d6a6bfa0f460f8663c2d72d07b60755a4857.tar.bz2 otp-7992d6a6bfa0f460f8663c2d72d07b60755a4857.zip |
Correct erl_global{register, unregister} functions
C node needs DFLAG_DIST_MONITOR flag set when connecting,
and support for processing monitoring start/end messages
received from counterpart, to make global registration
actually work.
Diffstat (limited to 'lib/erl_interface/src/legacy/global_register.c')
-rw-r--r-- | lib/erl_interface/src/legacy/global_register.c | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/erl_interface/src/legacy/global_register.c b/lib/erl_interface/src/legacy/global_register.c index 3a4de8b08e..f12eb6b448 100644 --- a/lib/erl_interface/src/legacy/global_register.c +++ b/lib/erl_interface/src/legacy/global_register.c @@ -31,7 +31,7 @@ int erl_global_register(int fd, const char *name, ETERM *pid) int index = 0; erlang_pid self; erlang_msg msg; - int needlink, needatom; + int needlink, needatom, needmonitor; int arity; int version; int msglen; @@ -65,7 +65,7 @@ int erl_global_register(int fd, const char *name, ETERM *pid) if (ei_send_reg_encoded(fd,&self,"rex",buf,index)) return -1; /* get the reply: expect link and an atom, or just an atom */ - needlink = needatom = 1; + needlink = needatom = needmonitor = 1; while (1) { /* get message */ while (1) { @@ -78,9 +78,15 @@ int erl_global_register(int fd, const char *name, ETERM *pid) case ERL_LINK: /* got link */ if (!needlink) return -1; - needlink = 0; + needlink = 0; break; + case ERL_MONITOR_P-10: + /* got monitor */ + if (!needmonitor) { return -1;} + needmonitor = 0; + break; + case ERL_SEND: /* got message - does it contain our atom? */ if (!needatom) return -1; |