[omniORB] Small tweak for local object detection

Chris Newbold cnewbold@laurelnetworks.com
Tue Aug 13 23:07:01 2002


We ran into a limitation of the algorithm used by omniORB4 in
giopRope.cc for determining whether or not an object reference
identifies a local object.

In our environment, we have one "active" host and other hosts on
"hot-standby"; each of these hosts has a unique IP address. In addition,
there in a special "active" IP address which is owned by the current
active host. On failover, the new active host takes ownership of this
address.

All hosts publish both their unique IP address and the "active" IP
address in all IORs; this allows the collection of hosts to talk among
themselves using the unique addresses while allowing clients transparent
access via the "active" address.

The problem with the local object detection algorithm is that it
declares success after matching only one address in an incoming IOR.
Since all our IORs contain the special "active" address, omniORB always
thinks these objects are local.

Included below is a small patch to giopRope.cc which changes the
matching algorithm. With the patch, all addresses in the incoming IOR
must match the local endpoints for an object to be declared local.

I figured we'd push this back to the omniORB community since it seems
like it might be generally useful.

--

==== //depot/comp/CORBA/omniORB_4/src/lib/omniORB/orbcore/giopRope.cc#1
(text) -
//depot/comp/CORBA/omniORB_4/src/lib/omniORB/orbcore/giopRope.cc#2
(text) ==== content
***************
*** 558,569 ****
    giopAddressList::const_iterator i, last;
    i    = addrlist.begin();
    last = addrlist.end();
    for (; i != last; i++) {
!     if (omniObjAdapter::matchMyEndpoints((*i)->address())) {
!       r = 0; loc = 1;
!       return 1;
      }
    }

    giopRope* gr;

--- 558,575 ----
    giopAddressList::const_iterator i, last;
    i    = addrlist.begin();
    last = addrlist.end();
+   OMNIORB_ASSERT( i != last );
    for (; i != last; i++) {
!     if (!omniObjAdapter::matchMyEndpoints((*i)->address())) {
!         break;
      }
    }
+   if (i == last)
+   {
+     // all matched, is a local object
+     r = 0; loc = 1;
+     return 1;
+   }

    giopRope* gr;       


-- 
====( Chris Newbold  <cnewbold@laurelnetworks.com> )===========================
      Laurel Networks, Inc. voice: +1 412 809 4200 fax: +1 412 809 4201
"If you fool around with a thing for very long you will screw it up." --Murphy
-------------------------------------------------------------------------------