why doesn't oafd register OD and AC on startup?



Yes, why? Is there a deeper reason that I don't know about? ;)

Imagine the following scenario: an oafd is spawned on by some process,
not via liboaf that would register it immediately, liboaf is then used
from another process to activate an object or register a server or sth.
like that. As the AC and OD provided by the already spawned oafd are not
registered yet (no calls to liboaf that would register them were made),
the second process spawns its own oafd via liboaf. This way you have two
oafds running instead of one.

The attached patch solves this problem. is it OK to commit it?

regards,
	jaKa

-- 

email: jaka.mocnik@kiss.uni-lj.si
w3:    http://pluton.ijs.si/~jaka
Index: oafd/main.c
===================================================================
RCS file: /cvs/gnome/oaf/oafd/main.c,v
retrieving revision 1.13
diff -u -r1.13 main.c
--- oafd/main.c	2000/05/31 19:03:45	1.13
+++ oafd/main.c	2000/06/13 18:22:54
@@ -56,8 +56,8 @@
 	CORBA_ORB orb;
 	PortableServer_POA root_poa;
 	CORBA_Environment ev;
-	OAF_ObjectDirectory od;
-	OAF_ActivationContext ac;
+	OAF_ObjectDirectory od = CORBA_OBJECT_NIL;
+	OAF_ActivationContext ac = CORBA_OBJECT_NIL;
 	CORBA_Object primary_server;
 	poptContext ctx;
 	char *ior;
@@ -123,6 +123,23 @@
 	} else
 		primary_server = od;
 
+	{
+		OAFRegistrationCategory regcat = {
+                        NULL, NULL, NULL, NULL, NULL
+                };
+		regcat.session_name = oaf_session_name_get();
+		regcat.username = oaf_username_get();
+                regcat.hostname = oaf_hostname_get();
+                if(ac != CORBA_OBJECT_NIL) {
+                        regcat.name = "IDL:OAF/ActivationContext:1.0";
+                        oaf_registration_set(&regcat, ac, &ev);
+                }
+                if(od != CORBA_OBJECT_NIL) {
+                        regcat.name = "IDL:OAF/ObjectDirectory:1.0";
+                        oaf_registration_set(&regcat, od, &ev);
+                }
+        }
+	
 	ior = CORBA_ORB_object_to_string (orb, primary_server, &ev);
 
 	fh = NULL;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]