[omniORB] Help System Exception

Andrew Mak makwha@stee.com.sg
Mon Jul 15 08:59:01 2002


--=====================_9926533==_.ALT
Content-Type: text/plain; charset="us-ascii"; format=flowed

Hi All,

I hope someone else has encountered this problem or know how to solve it!! 
I really don't know why this exception is thrown. Here I go. So far we've 
debugged it down to here:

BTW I am using Win NT 4 Sp6a VC5, OmniOrb v3.04.

When the invoke function is called (below 
omniObjRef.cc),   _identity()->dispatch(call_desc); will throw out an 
exception.  In the dispatch function found in  (below 
remoteIdentity.cc)  switch( giop_c.ReceiveReply() ). In this statement 
ReceiveReply() (below giopClient.cc), the exception thrown is: (it's scary 
as the comment is  // never reaches here and I can get there!)

  CORBA::ULong rc;
   rc <<= *this;
   switch (rc) {
   case GIOP::SYSTEM_EXCEPTION:
     {
       UnMarshallSystemException();
       // never reaches here
     }
     break;

The value of RC = 2 which is case GIOP::SYSTEM_EXCEPTION: . After which it 
calls the UnMarshallSystemException();


--------------------------------------------------------------------------------------------------------------------------
omniObjRef.cc
--------------------------------------------------------------------------------------------------------------------------
void
omniObjRef::_invoke(omniCallDescriptor& call_desc, CORBA::Boolean do_assert)
{
   int retries = 0;
#if defined(__DECCXX) && __DECCXX_VER < 60300000
   // Work-around for bug in Compaq C++ optimiser
   volatile
#endif
   int fwd;
   if( _is_nil() )  _CORBA_invoked_nil_objref();
#ifndef EGCS_WORKAROUND
  _again:
#else
   while(1) {
#endif
     if( omniORB::verifyObjectExistsAndType && do_assert )
       _assertExistsAndTypeVerified();
     try{
       omni::internalLock->lock();
       fwd = pd_flags.forward_location;
       _identity()->dispatch(call_desc);
       return;
     }
     catch(CORBA::COMM_FAILURE& ex) {
       if( fwd ) {
         omni::revertToOriginalProfile(this);
         CORBA::TRANSIENT ex2(ex.minor(), ex.completed());
         if( !_omni_callTransientExceptionHandler(this, retries++, ex2) )
           throw ex2;
       }
       else if( !_omni_callCommFailureExceptionHandler(this, retries++, ex) )
         throw;
     }
     catch(CORBA::TRANSIENT& ex) {
       if( !_omni_callTransientExceptionHandler(this, retries++, ex) )
         throw;
     }
     catch(CORBA::OBJECT_NOT_EXIST& ex) {
       if( fwd ){
         omni::revertToOriginalProfile(this);
         CORBA::TRANSIENT ex2(ex.minor(), ex.completed());
         if( !_omni_callTransientExceptionHandler(this, retries++, ex2) )
           throw ex2;
       }
       else if( !_omni_callSystemExceptionHandler(this, retries++, ex) )
         throw;
     }
     catch(CORBA::SystemException& ex) {
       if( !_omni_callSystemExceptionHandler(this, retries++, ex) )
         throw;
     }
     catch(omniORB::LOCATION_FORWARD& ex) {
       if( CORBA::is_nil(ex.get_obj()) ) {
         CORBA::COMM_FAILURE ex2(0, CORBA::COMPLETED_NO);
         if( omniORB::traceLevel > 10 ){
           omniORB::log << "Received GIOP::LOCATION_FORWARD message that"
             " contains a nil object reference.\n";
           omniORB::log.flush();
         }
         if( !_omni_callCommFailureExceptionHandler(this, retries++, ex2) )
           throw ex2;
       }
       omni::locationForward(this, ex.get_obj()->_PR_getobj());
     }
#ifndef EGCS_WORKAROUND
     goto _again;
#else
   }
#endif
}
--------------------------------------------------------------------------------------------------------------------------
end - omniObjRef.cc
--------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------
remoteIdenity.cc
--------------------------------------------------------------------------------------------------------------------------
void
omniRemoteIdentity::dispatch(omniCallDescriptor& call_desc)
{
   ASSERT_OMNI_TRACEDMUTEX_HELD(*omni::internalLock, 1);
   omniRemoteIdentity_RefHolder rh(this);
   if( omniORB::traceInvocations ) {
     omniORB::logger l;
     l << "Invoke '" << call_desc.op() << "' on remote: " << this << '\n';
   }
   CORBA::Boolean reuse = 0; //?? move this up into transport
   const omniCallDescriptor::ContextInfo* ctxt_info = call_desc.context_info();
   try {
     GIOP_C giop_c(rope());
     reuse = giop_c.isReUsingExistingConnection();
     // Calculate the size of the message.
     CORBA::ULong msgsize =
       GIOP_C::RequestHeaderSize(keysize(), call_desc.op_len());
     msgsize = call_desc.alignedSize(msgsize);
     if( ctxt_info )
       msgsize = omniDynamicLib::ops->context_aligned_size(msgsize,
                                                   ctxt_info->context,
                                                   ctxt_info->expected,
                                                   ctxt_info->num_expected);
     giop_c.InitialiseRequest(key(), keysize(), call_desc.op(),
                              call_desc.op_len(), msgsize,
                              call_desc.is_oneway());
     // Marshal the arguments to the operation.
     call_desc.marshalArguments(giop_c);
     if( ctxt_info )
       omniDynamicLib::ops->marshal_context(giop_c, ctxt_info->context,
                                            ctxt_info->expected,
                                            ctxt_info->num_expected);
     // Wait for the reply.
     switch( giop_c.ReceiveReply() ) {
     case GIOP::NO_EXCEPTION:
       // Unmarshal any result and out/inout arguments.
       call_desc.unmarshalReturnedValues(giop_c);
       giop_c.RequestCompleted();
       break;
     case GIOP::USER_EXCEPTION:
       {
         // Retrieve the Interface Repository ID of the exception.
         CORBA::ULong repoIdLen;
         repoIdLen <<= giop_c;
         if( repoIdLen > giop_c.RdMessageUnRead() )
           OMNIORB_THROW(MARSHAL,0, CORBA::COMPLETED_MAYBE);
         CORBA::String_var repoId(omni::allocString(repoIdLen - 1));
         giop_c.get_char_array((CORBA::Char*)(char*) repoId, repoIdLen);
         call_desc.userException(giop_c, repoId);
         // Never get here - this must throw either a user exception
         // or CORBA::MARSHAL.
         OMNIORB_ASSERT(0);
       }
     case GIOP::LOCATION_FORWARD:
       {
         CORBA::Object_var obj(CORBA::Object::_unmarshalObjRef(giop_c));
         giop_c.RequestCompleted();
         throw omniORB::LOCATION_FORWARD(obj._retn());
       }
     case GIOP::SYSTEM_EXCEPTION:
       OMNIORB_ASSERT(0);
       break;
     }
   }
   catch(omniConnectionBroken& ex) {
     if( reuse ){
       CORBA::TRANSIENT ex2(ex.minor(), ex.completed());
       throw ex2;
     }
     else {
       OMNIORB_THROW(COMM_FAILURE, ex.minor(), ex.completed());
     }
   }
}

--------------------------------------------------------------------------------------------------------------------------
end - remoteIdenity.cc
--------------------------------------------------------------------------------------------------------------------------

--------------------------------------------------------------------------------------------------------------------------
giopClient.cc
--------------------------------------------------------------------------------------------------------------------------

GIOP::ReplyStatusType
GIOP_C::ReceiveReply()
{
   if (pd_state != GIOP_C::RequestInProgress)
     throw omniORB::fatalException(__FILE__,__LINE__,
       "GIOP_C::ReceiveReply() entered with the wrong state.");
   if (WrMessageSpaceLeft())
     throw omniORB::fatalException(__FILE__,__LINE__,
        "GIOP_C::ReceiveReply() reported wrong request message size.");
   pd_state = GIOP_C::WaitingForReply;
   flush(1);
  if (!pd_response_expected) {
     pd_state = GIOP_C::ReplyIsBeingProcessed;
     return GIOP::NO_EXCEPTION;
   }

   RdMessageSize(0,omni::myByteOrder);
   MessageHeader::HeaderType hdr;
   get_char_array((CORBA::Char*) hdr, sizeof(MessageHeader::HeaderType),
                  omni::ALIGN_1, 1);
   pd_state = GIOP_C::ReplyIsBeingProcessed;
   if (hdr[0] != MessageHeader::Reply[0] ||
       hdr[1] != MessageHeader::Reply[1] ||
       hdr[2] != MessageHeader::Reply[2] ||
       hdr[3] != MessageHeader::Reply[3] ||
       hdr[4] != MessageHeader::Reply[4] ||
       hdr[5] != MessageHeader::Reply[5] ||
       hdr[7] != MessageHeader::Reply[7])
     {
       // Wrong header
       setStrandIsDying();
       OMNIORB_THROW_CONNECTION_BROKEN(0,CORBA::COMPLETED_MAYBE);
     }
   CORBA::ULong msgsize;
   msgsize <<= *this;
   if (hdr[6] != omni::myByteOrder) {
     msgsize =  ((((msgsize) & 0xff000000) >> 24) |
                 (((msgsize) & 0x00ff0000) >> 8)  |
                 (((msgsize) & 0x0000ff00) << 8)  |
                 (((msgsize) & 0x000000ff) << 24));
   }
   if (msgsize > MaxMessageSize()) {
     // message size has exceeded the limit
     setStrandIsDying();
     OMNIORB_THROW_CONNECTION_BROKEN(0,CORBA::COMPLETED_MAYBE);
   }
   RdMessageSize(msgsize,hdr[6]);
   // XXX Do not support any service context yet,
   // XXX For the moment, skips the service context
   CORBA::ULong svcccount;
   CORBA::ULong svcctag;
   CORBA::ULong svcctxtsize;
   svcccount <<= *this;
   while (svcccount-- > 0) {
     svcctag <<= *this;
     svcctxtsize <<= *this;
     skip(svcctxtsize);
   };
   CORBA::ULong req_id;
   req_id <<= *this;
   if (req_id != pd_request_id) {
     // Not the expected reply, skip the entire message
     skip(RdMessageUnRead(),1);
     pd_state = GIOP_C::RequestInProgress;
     return this->ReceiveReply();
   }
   CORBA::ULong rc;
   rc <<= *this;
   switch (rc) {
   case GIOP::SYSTEM_EXCEPTION:
     {
       UnMarshallSystemException();
       // never reaches here
     }
     break;
   case GIOP::NO_EXCEPTION:
   case GIOP::USER_EXCEPTION:
   case GIOP::LOCATION_FORWARD:
     break;
   default:
     // Should never receive anything other that the above
     // Same treatment as wrong header
     setStrandIsDying();
     OMNIORB_THROW_CONNECTION_BROKEN(0,CORBA::COMPLETED_MAYBE);
   }
   return (GIOP::ReplyStatusType)rc;
}
--------------------------------------------------------------------------------------------------------------------------
end - giopClient.cc
--------------------------------------------------------------------------------------------------------------------------

Best Regards


   /\       |\  /|
  /--\ndrew | \/ |ak
/    \     |    |

Senior Engineer
Singapore Technologies Electronics Ltd
Product Development & Management Division (PDMD)
Large-Scale Systems Group
(65) 6413 1613 (Direct)
(65) 6484 8841 (Fax)
mailto:makwha@stee.st.com.sg
www.stee.com.sg
--=====================_9926533==_.ALT
Content-Type: text/html; charset="us-ascii"

<html>
Hi All,<br><br>
I hope someone else has encountered this problem or know how to solve
it!! I really don't know why this exception is thrown. Here I go. So far
we've debugged it down to here:<br><br>
BTW I am using Win NT 4 Sp6a VC5, OmniOrb v3.04.<br><br>
When the invoke function is called (below omniObjRef.cc),
<font color="#FF0000">&nbsp; _identity()-&gt;dispatch(call_desc);
</font>will throw out an exception.&nbsp; In the dispatch function found
in&nbsp; (below remoteIdentity.cc) <font color="#FF0000"> switch(
giop_c.ReceiveReply() </font>). In this statement ReceiveReply() (below
giopClient.cc), the exception thrown is: (it's scary as the comment is
<font color="#FF0000"> // never reaches here </font>and I can get
there!)<br><br>
&nbsp;<font color="#FF0000">CORBA::ULong rc;<br>
&nbsp; rc &lt;&lt;= *this;<br>
&nbsp; switch (rc) {<br>
&nbsp; case GIOP::SYSTEM_EXCEPTION:<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UnMarshallSystemException();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // never reaches here<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; break;<br><br>
</font>The value of RC = 2 which is <font color="#FF0000">case
GIOP::SYSTEM_EXCEPTION: </font>. After which it calls the
<font color="#FF0000">UnMarshallSystemException(); <br><br>
<br>
</font>--------------------------------------------------------------------------------------------------------------------------<br>
omniObjRef.cc<br>
--------------------------------------------------------------------------------------------------------------------------<br>
void<br>
omniObjRef::_invoke(omniCallDescriptor&amp; call_desc, CORBA::Boolean
do_assert)<br>
{<br>
&nbsp; int retries = 0;<br>
#if defined(__DECCXX) &amp;&amp; __DECCXX_VER &lt; 60300000<br>
&nbsp; // Work-around for bug in Compaq C++ optimiser<br>
&nbsp; volatile<br>
#endif<br>
&nbsp; int fwd;<br>
&nbsp; if( _is_nil() )&nbsp; _CORBA_invoked_nil_objref();<br>
#ifndef EGCS_WORKAROUND<br>
&nbsp;_again:<br>
#else<br>
&nbsp; while(1) {<br>
#endif<br>
&nbsp;&nbsp;&nbsp; if( omniORB::verifyObjectExistsAndType &amp;&amp;
do_assert )<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; _assertExistsAndTypeVerified();<br>
&nbsp;&nbsp;&nbsp; try{<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; omni::internalLock-&gt;lock();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; fwd = pd_flags.forward_location;<br>
<font color="#FF0000">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
_identity()-&gt;dispatch(call_desc);<br>
</font>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; return;<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; catch(CORBA::COMM_FAILURE&amp; ex) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if( fwd ) {<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>omni::revertToOriginalProfile(this);<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>CORBA::TRANSIENT
ex2(ex.minor(), ex.completed());<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>if(
!_omni_callTransientExceptionHandler(this, retries++, ex2) )<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;
throw ex2;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if(
!_omni_callCommFailureExceptionHandler(this, retries++, ex) )<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>throw;<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; catch(CORBA::TRANSIENT&amp; ex) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(
!_omni_callTransientExceptionHandler(this, retries++, ex) )<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>throw;<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; catch(CORBA::OBJECT_NOT_EXIST&amp; ex) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if( fwd ){<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>omni::revertToOriginalProfile(this);<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>CORBA::TRANSIENT
ex2(ex.minor(), ex.completed());<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>if(
!_omni_callTransientExceptionHandler(this, retries++, ex2) )<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;
throw ex2;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else if(
!_omni_callSystemExceptionHandler(this, retries++, ex) )<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>throw;<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; catch(CORBA::SystemException&amp; ex) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if(
!_omni_callSystemExceptionHandler(this, retries++, ex) )<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>throw;<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; catch(omniORB::LOCATION_FORWARD&amp; ex) {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if( CORBA::is_nil(ex.get_obj()) ) {<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>CORBA::COMM_FAILURE
ex2(0, CORBA::COMPLETED_NO);<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>if(
omniORB::traceLevel &gt; 10 ){<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;
omniORB::log &lt;&lt; &quot;Received GIOP::LOCATION_FORWARD message
that&quot;<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;
&quot; contains a nil object reference.\n&quot;;<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;
omniORB::log.flush();<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>}<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>if(
!_omni_callCommFailureExceptionHandler(this, retries++, ex2) )<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;
throw ex2;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; omni::locationForward(this,
ex.get_obj()-&gt;_PR_getobj());<br>
&nbsp;&nbsp;&nbsp; }<br>
#ifndef EGCS_WORKAROUND<br>
&nbsp;&nbsp;&nbsp; goto _again;<br>
#else<br>
&nbsp; }<br>
#endif<br>
}<br>
--------------------------------------------------------------------------------------------------------------------------<br>
end - omniObjRef.cc<br>
--------------------------------------------------------------------------------------------------------------------------<br><br>
--------------------------------------------------------------------------------------------------------------------------<br>
remoteIdenity.cc<br>
--------------------------------------------------------------------------------------------------------------------------<br>
void<br>
omniRemoteIdentity::dispatch(omniCallDescriptor&amp; call_desc)<br>
{<br>
&nbsp; ASSERT_OMNI_TRACEDMUTEX_HELD(*omni::internalLock, 1);<br>
&nbsp; omniRemoteIdentity_RefHolder rh(this);<br>
&nbsp; if( omniORB::traceInvocations ) {<br>
&nbsp;&nbsp;&nbsp; omniORB::logger l;<br>
&nbsp;&nbsp;&nbsp; l &lt;&lt; &quot;Invoke '&quot; &lt;&lt;
call_desc.op() &lt;&lt; &quot;' on remote: &quot; &lt;&lt; this &lt;&lt;
'\n';<br>
&nbsp; }<br>
&nbsp; CORBA::Boolean reuse = 0; //?? move this up into transport<br>
&nbsp; const omniCallDescriptor::ContextInfo* ctxt_info =
call_desc.context_info();<br>
&nbsp; try {<br>
&nbsp;&nbsp;&nbsp; GIOP_C giop_c(rope());<br>
&nbsp;&nbsp;&nbsp; reuse = giop_c.isReUsingExistingConnection();<br>
&nbsp;&nbsp;&nbsp; // Calculate the size of the message.<br>
&nbsp;&nbsp;&nbsp; CORBA::ULong msgsize =<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GIOP_C::RequestHeaderSize(keysize(),
call_desc.op_len());<br>
&nbsp;&nbsp;&nbsp; msgsize = call_desc.alignedSize(msgsize);<br>
&nbsp;&nbsp;&nbsp; if( ctxt_info )<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; msgsize =
omniDynamicLib::ops-&gt;context_aligned_size(msgsize,<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;
ctxt_info-&gt;context,<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;
ctxt_info-&gt;expected,<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;
ctxt_info-&gt;num_expected);<br>
&nbsp;&nbsp;&nbsp; giop_c.InitialiseRequest(key(), keysize(),
call_desc.op(),<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;&nbsp;
call_desc.op_len(), msgsize,<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;&nbsp;&nbsp;
call_desc.is_oneway());<br>
&nbsp;&nbsp;&nbsp; // Marshal the arguments to the operation.<br>
&nbsp;&nbsp;&nbsp; call_desc.marshalArguments(giop_c);<br>
&nbsp;&nbsp;&nbsp; if( ctxt_info )<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
omniDynamicLib::ops-&gt;marshal_context(giop_c,
ctxt_info-&gt;context,<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;
ctxt_info-&gt;expected,<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;&nbsp;
ctxt_info-&gt;num_expected);<br>
&nbsp;&nbsp;&nbsp; // Wait for the reply.<br>
&nbsp; <font color="#FF0000">&nbsp; switch( giop_c.ReceiveReply() )
{<br>
&nbsp;&nbsp;&nbsp; case GIOP::NO_EXCEPTION:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Unmarshal any result and out/inout
arguments.<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
call_desc.unmarshalReturnedValues(giop_c);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; giop_c.RequestCompleted();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>
</font>&nbsp;&nbsp;&nbsp; case GIOP::USER_EXCEPTION:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>//
Retrieve the Interface Repository ID of the exception.<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>CORBA::ULong
repoIdLen;<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>repoIdLen
&lt;&lt;= giop_c;<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>if(
repoIdLen &gt; giop_c.RdMessageUnRead() )<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>&nbsp;
OMNIORB_THROW(MARSHAL,0, CORBA::COMPLETED_MAYBE);<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>CORBA::String_var
repoId(omni::allocString(repoIdLen - 1));<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>giop_c.get_char_array((CORBA::Char*)(char*)
repoId, repoIdLen);<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>call_desc.userException(giop_c,
repoId);<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>// Never
get here - this must throw either a user exception<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>// or
CORBA::MARSHAL.<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>OMNIORB_ASSERT(0);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; case GIOP::LOCATION_FORWARD:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>CORBA::Object_var
obj(CORBA::Object::_unmarshalObjRef(giop_c));<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>giop_c.RequestCompleted();<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>throw
omniORB::LOCATION_FORWARD(obj._retn());<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; case GIOP::SYSTEM_EXCEPTION:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OMNIORB_ASSERT(0);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp; }<br>
&nbsp; catch(omniConnectionBroken&amp; ex) {<br>
&nbsp;&nbsp;&nbsp; if( reuse ){<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; CORBA::TRANSIENT ex2(ex.minor(),
ex.completed());<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; throw ex2;<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; else {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OMNIORB_THROW(COMM_FAILURE, ex.minor(),
ex.completed());<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp; }<br>
}<br><br>
--------------------------------------------------------------------------------------------------------------------------<br>
end - remoteIdenity.cc<br>
--------------------------------------------------------------------------------------------------------------------------<br><br>
--------------------------------------------------------------------------------------------------------------------------<br>
giopClient.cc<br>
--------------------------------------------------------------------------------------------------------------------------<br><br>
GIOP::ReplyStatusType <br>
GIOP_C::ReceiveReply()<br>
{<br>
&nbsp; if (pd_state != GIOP_C::RequestInProgress)<br>
&nbsp;&nbsp;&nbsp; throw omniORB::fatalException(__FILE__,__LINE__,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;GIOP_C::ReceiveReply() entered with
the wrong state.&quot;);<br>
&nbsp; if (WrMessageSpaceLeft())<br>
&nbsp;&nbsp;&nbsp; throw omniORB::fatalException(__FILE__,__LINE__,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &quot;GIOP_C::ReceiveReply()
reported wrong request message size.&quot;);<br>
&nbsp; pd_state = GIOP_C::WaitingForReply;<br>
&nbsp; flush(1);<br>
&nbsp;if (!pd_response_expected) {<br>
&nbsp;&nbsp;&nbsp; pd_state = GIOP_C::ReplyIsBeingProcessed;<br>
&nbsp;&nbsp;&nbsp; return GIOP::NO_EXCEPTION;<br>
&nbsp; }<br>
&nbsp; <br>
&nbsp; RdMessageSize(0,omni::myByteOrder);<br>
&nbsp; MessageHeader::HeaderType hdr;<br>
&nbsp; get_char_array((CORBA::Char*) hdr,
sizeof(MessageHeader::HeaderType),<br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>
omni::ALIGN_1, 1);<br>
&nbsp; pd_state = GIOP_C::ReplyIsBeingProcessed;<br>
&nbsp; if (hdr[0] != MessageHeader::Reply[0] ||<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hdr[1] != MessageHeader::Reply[1] ||<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hdr[2] != MessageHeader::Reply[2] ||<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hdr[3] != MessageHeader::Reply[3] ||<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hdr[4] != MessageHeader::Reply[4] ||<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hdr[5] != MessageHeader::Reply[5] ||<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hdr[7] != MessageHeader::Reply[7])<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // Wrong header<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; setStrandIsDying();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; OMNIORB_THROW_CONNECTION_BROKEN(0,CORBA::COMPLETED_MAYBE);<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp; CORBA::ULong msgsize;<br>
&nbsp; msgsize &lt;&lt;= *this;<br>
&nbsp; if (hdr[6] != omni::myByteOrder) {<br>
&nbsp;&nbsp;&nbsp; msgsize =&nbsp; ((((msgsize) &amp; 0xff000000) &gt;&gt; 24) | <br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>(((msgsize) &amp; 0x00ff0000) &gt;&gt; 8)&nbsp; | <br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>(((msgsize) &amp; 0x0000ff00) &lt;&lt; 8)&nbsp; | <br>
<x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab><x-tab>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</x-tab>(((msgsize) &amp; 0x000000ff) &lt;&lt; 24));<br>
&nbsp; }<br>
&nbsp; if (msgsize &gt; MaxMessageSize()) {<br>
&nbsp;&nbsp;&nbsp; // message size has exceeded the limit<br>
&nbsp;&nbsp;&nbsp; setStrandIsDying();<br>
&nbsp;&nbsp;&nbsp; OMNIORB_THROW_CONNECTION_BROKEN(0,CORBA::COMPLETED_MAYBE);<br>
&nbsp; }<br>
&nbsp; RdMessageSize(msgsize,hdr[6]);<br>
&nbsp; // XXX Do not support any service context yet, <br>
&nbsp; // XXX For the moment, skips the service context<br>
&nbsp; CORBA::ULong svcccount;<br>
&nbsp; CORBA::ULong svcctag;<br>
&nbsp; CORBA::ULong svcctxtsize;<br>
&nbsp; svcccount &lt;&lt;= *this;<br>
&nbsp; while (svcccount-- &gt; 0) {<br>
&nbsp;&nbsp;&nbsp; svcctag &lt;&lt;= *this;<br>
&nbsp;&nbsp;&nbsp; svcctxtsize &lt;&lt;= *this;<br>
&nbsp;&nbsp;&nbsp; skip(svcctxtsize);<br>
&nbsp; };<br>
&nbsp; CORBA::ULong req_id;<br>
&nbsp; req_id &lt;&lt;= *this;<br>
&nbsp; if (req_id != pd_request_id) {<br>
&nbsp;&nbsp;&nbsp; // Not the expected reply, skip the entire message<br>
&nbsp;&nbsp;&nbsp; skip(RdMessageUnRead(),1);<br>
&nbsp;&nbsp;&nbsp; pd_state = GIOP_C::RequestInProgress;<br>
&nbsp;&nbsp;&nbsp; return this-&gt;ReceiveReply();<br>
&nbsp; }<br>
&nbsp;<font color="#FF0000"> CORBA::ULong rc;<br>
&nbsp; rc &lt;&lt;= *this;<br>
&nbsp; switch (rc) {<br>
&nbsp; case GIOP::SYSTEM_EXCEPTION:<br>
&nbsp;&nbsp;&nbsp; {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UnMarshallSystemException();<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; // never reaches here<br>
&nbsp;&nbsp;&nbsp; }<br>
</font>&nbsp;&nbsp;&nbsp; break;<br>
&nbsp; case GIOP::NO_EXCEPTION:<br>
&nbsp; case GIOP::USER_EXCEPTION:<br>
&nbsp; case GIOP::LOCATION_FORWARD:<br>
&nbsp;&nbsp;&nbsp; break;<br>
&nbsp; default:<br>
&nbsp;&nbsp;&nbsp; // Should never receive anything other that the above<br>
&nbsp;&nbsp;&nbsp; // Same treatment as wrong header<br>
&nbsp;&nbsp;&nbsp; setStrandIsDying();<br>
&nbsp;&nbsp;&nbsp; OMNIORB_THROW_CONNECTION_BROKEN(0,CORBA::COMPLETED_MAYBE);<br>
&nbsp; }<br>
&nbsp; return (GIOP::ReplyStatusType)rc;<br>
}<br>
--------------------------------------------------------------------------------------------------------------------------<br>
end - giopClient.cc<br>
--------------------------------------------------------------------------------------------------------------------------<br><br>
Best Regards<br><br>
<x-sigsep><p></x-sigsep>
&nbsp; /\&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; |\&nbsp; /|<br>
&nbsp;/--\ndrew | \/ |ak<br>
/&nbsp;&nbsp;&nbsp; \&nbsp;&nbsp;&nbsp;&nbsp; |&nbsp;&nbsp;&nbsp; |<br><br>
Senior Engineer<br>
Singapore Technologies Electronics Ltd<br>
Product Development &amp; Management Division (PDMD)<br>
Large-Scale Systems Group<br>
(65) 6413 1613 (Direct) <br>
(65) 6484 8841 (Fax)<br>
<a href="mailto:makwha@stee.st.com.sg" eudora="autourl">mailto:makwha@stee.st.com.sg<br>
</a><a href="http://www.stee.com.sg/" eudora="autourl">www.stee.com.sg</a></html>

--=====================_9926533==_.ALT--