aboutsummaryrefslogtreecommitdiffstats
path: root/lib/erl_interface/src/legacy/global_unregister.c
diff options
context:
space:
mode:
authorVitaliy Batichko <[email protected]>2010-11-29 20:42:28 +0200
committerVitaliy Batichko <[email protected]>2010-12-10 17:32:02 +0200
commit7992d6a6bfa0f460f8663c2d72d07b60755a4857 (patch)
treead9ff808f00832c32ea84f8a447a8e106a99f3e5 /lib/erl_interface/src/legacy/global_unregister.c
parent95392e693e210189df82173c9bcd345b58b004fe (diff)
downloadotp-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_unregister.c')
-rw-r--r--lib/erl_interface/src/legacy/global_unregister.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/erl_interface/src/legacy/global_unregister.c b/lib/erl_interface/src/legacy/global_unregister.c
index 514dbc3c68..97a1c2d03c 100644
--- a/lib/erl_interface/src/legacy/global_unregister.c
+++ b/lib/erl_interface/src/legacy/global_unregister.c
@@ -37,7 +37,7 @@ int erl_global_unregister(int fd, const char *name)
erlang_msg msg;
int i;
int version,arity,msglen;
- int needunlink, needatom;
+ int needunlink, needatom, needdemonitor;
/* make a self pid */
self->num = fd;
@@ -57,7 +57,7 @@ int erl_global_unregister(int fd, const char *name)
if (ei_send_reg_encoded(fd,self,"rex",buf,index)) return -1;
/* get the reply: expect unlink and an atom, or just an atom */
- needunlink = needatom = 1;
+ needunlink = needatom = needdemonitor = 1;
while (1) {
/* get message */
while (1) {
@@ -68,11 +68,17 @@ int erl_global_unregister(int fd, const char *name)
switch (i) {
case ERL_UNLINK:
- /* got link */
+ /* got unlink */
if (!needunlink) return -1;
needunlink = 0;
break;
+ case ERL_DEMONITOR_P-10:
+ /* got demonitor */
+ if (!needdemonitor) return -1;
+ needdemonitor = 0;
+ break;
+
case ERL_SEND:
/* got message - does it contain our atom? */
if (!needatom) return -1;