[omniORB] Parsing and logging initial references

Matej Kenda matejkenda@volja.net
Tue Mar 4 14:03:02 2003


This is a multi-part message in MIME format.
--------------000603070607080606020702
Content-Type: text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding: 7bit

  Hi,

I have implemented a piece of code that creates options and passes them
to the ORB_init(). The piece of code that does this looks like this:

// ORB options
const char* options[] [2] = {
    {"InitRef",                     initRef},
    {"DefaultInitRef",              defInitRef},
    {"maxGIOPConnectionPerServer",  maxgiop},
    {NULL, NULL}
};
m_orb = CORBA::ORB_init(a_argc, a_argv, s_orbName, options);

I had some problems and turned on the logging (level 30). I noticed that
DefaultInitRef was not displayed among the parsed arguments. Output
looked like this:

omniORB: Current configuration is as follows:
omniORB:   DefaultInitRef =
omniORB:   InitRef = NameService=corbaname:iiop:cumulus.hermes.si:2809
omniORB:   abortOnInternalError = 0
omniORB:   acceptBiDirectionalGIOP = 0
omniORB:   acceptMisalignedTcIndirections = 0
omniORB:   bootstrapAgentHostname =
omniORB:   bootstrapAgentPort = 900
...

I have checked the code and found out that omniORB stores values from
the config file and the arguments in two separate values.

The method DefaultInitRefHandler::dump(..) didn't handle both values but
it should display the variable because it was passed as ORB argument.

I have changed the dump() and added some logs into the code
(initRefs.cc) and discovered that parsing of ORB options "thinks" that
the value was read from the cfg file. I haven't found the reason for
that.

Everything works, but it seems that ORB internally stores the parameters
incorrectly.

I have attached the diff that I have made to the inirRefs.cc to display
the parsed value of the DefaultInitRef correctly.

Best regards,

Matej

--------------000603070607080606020702
Content-Type: text/plain;
 name="initRefs.diff"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
 filename="initRefs.diff"

--- omniORB-4.0.0/src/lib/omniORB/orbcore/initRefs.cc	2003-01-29 11:31:18.000000000 +0100
+++ omniORB-4.0.0-1/src/lib/omniORB/orbcore/initRefs.cc	2003-03-04 14:29:26.000000000 +0100
@@ -852,17 +852,34 @@
 
   void visit(const char* value,orbOptions::Source src) throw (orbOptions::BadParam) {
     if (src == orbOptions::fromArgv) {
+      if (omniORB::trace(10)) {
+        omniORB::logger l;
+        l << "ARGV: DefaultInitRef = " << value;
+      }
       omniInitialReferences::setDefaultInitRefFromArgs(value);
     }
     else {
+      if (omniORB::trace(10)) {
+        omniORB::logger l;
+        l << "FILE: DefaultInitRef = " << value;
+      }
       omniInitialReferences::setDefaultInitRefFromFile(value);
     }
   }
 
   void dump(orbOptions::sequenceString& result) {
-    const char* v = the_argsDefaultInitRef;
-    if (!v) v = "";
-    orbOptions::addKVString(key(),v,result);
+    const char* a = the_argsDefaultInitRef;
+    const char* f = the_fileDefaultInitRef;
+    if (a) {
+      orbOptions::addKVString(key(), a, result);
+    }
+    else if (f) {
+      orbOptions::addKVString(key(), f, result);
+    }
+    else {
+        a = "";
+        orbOptions::addKVString(key(), a, result);
+    };
   }
 };
 

--------------000603070607080606020702--