summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbala <balanatarajan@users.noreply.github.com>2001-03-06 17:52:58 +0000
committerbala <balanatarajan@users.noreply.github.com>2001-03-06 17:52:58 +0000
commitb856f80ffcda55d035abc525d54ab4c225ee449f (patch)
tree867ca522fa8b8e32d458e41c562cc8fef7aa6616
parentaaa455ebfcd7977592282d2347e9b6a0ce728393 (diff)
downloadATCD-b856f80ffcda55d035abc525d54ab4c225ee449f.tar.gz
ChangeLogTag: Tue Mar 6 11:49:37 2001 Balachandran Natarajan <bala@cs.wustl.edu>
-rw-r--r--TAO/ChangeLogs/ChangeLog-02a8
-rw-r--r--TAO/tao/GIOP_Message_Base.cpp942
-rw-r--r--TAO/tao/GIOP_Message_Handler.cpp36
3 files changed, 499 insertions, 487 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a
index 0bd793b8c78..2b602be93a2 100644
--- a/TAO/ChangeLogs/ChangeLog-02a
+++ b/TAO/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,11 @@
+Tue Mar 6 11:49:37 2001 Balachandran Natarajan <bala@cs.wustl.edu>
+
+ * tao/GIOP_Message_Handler.cpp (is_message_ready):
+ * tao/GIOP_Message_Base.cpp: Made a pass through the code and
+ fixed a few ACE_DEBUG statements and HEXDUMP statements. Thanks
+ to Johnny.Willemsen <jwillemsen@mego.nl> for pointing these
+ out.
+
Tue Mar 06 10:58:15 2001 Frank Hunleth <fhunleth@cs.wustl.edu>
* examples/PluggableUDP/tests/client.dsp:
diff --git a/TAO/tao/GIOP_Message_Base.cpp b/TAO/tao/GIOP_Message_Base.cpp
index 2aaaf4d7a7e..a1bde01fa14 100644
--- a/TAO/tao/GIOP_Message_Base.cpp
+++ b/TAO/tao/GIOP_Message_Base.cpp
@@ -19,36 +19,36 @@ ACE_RCSID(tao, GIOP_Message_Base, "$Id$")
TAO_GIOP_Message_Base::TAO_GIOP_Message_Base (TAO_ORB_Core *orb_core)
: message_handler_ (orb_core,
- this),
+ this),
output_ (0),
cdr_buffer_alloc_ (
- orb_core->resource_factory ()->output_cdr_buffer_allocator ()
+ orb_core->resource_factory ()->output_cdr_buffer_allocator ()
),
cdr_dblock_alloc_ (
- orb_core->resource_factory ()->output_cdr_dblock_allocator ()
+ orb_core->resource_factory ()->output_cdr_dblock_allocator ()
),
generator_parser_ (0)
{
#if defined(ACE_HAS_PURIFY)
- (void) ACE_OS::memset (this->repbuf_,
- '\0',
- sizeof this->repbuf_);
+ (void) ACE_OS::memset (this->repbuf_,
+ '\0',
+ sizeof this->repbuf_);
#endif /* ACE_HAS_PURIFY */
ACE_NEW (this->output_,
- TAO_OutputCDR (this->repbuf_,
- sizeof this->repbuf_,
- TAO_ENCAP_BYTE_ORDER,
- this->cdr_buffer_alloc_,
- this->cdr_dblock_alloc_,
- orb_core->orb_params ()->cdr_memcpy_tradeoff (),
- orb_core->to_iso8859 (),
- orb_core->to_unicode ()));
+ TAO_OutputCDR (this->repbuf_,
+ sizeof this->repbuf_,
+ TAO_ENCAP_BYTE_ORDER,
+ this->cdr_buffer_alloc_,
+ this->cdr_dblock_alloc_,
+ orb_core->orb_params ()->cdr_memcpy_tradeoff (),
+ orb_core->to_iso8859 (),
+ orb_core->to_unicode ()));
}
TAO_GIOP_Message_Base::~TAO_GIOP_Message_Base (void)
{
- // Explicitly call the destructor of the output CDR first. They need
+ // Explicitly call the destructor of the output CDR first. They need
// the allocators during destruction.
delete this->output_;
@@ -65,11 +65,11 @@ TAO_GIOP_Message_Base::~TAO_GIOP_Message_Base (void)
void
TAO_GIOP_Message_Base::init (CORBA::Octet major,
- CORBA::Octet minor)
+ CORBA::Octet minor)
{
// Set the state
this->set_state (major,
- minor);
+ minor);
}
@@ -89,24 +89,24 @@ TAO_GIOP_Message_Base::generate_request_header (
{
// Write the GIOP header first
if (!this->write_protocol_header (TAO_GIOP_REQUEST,
- cdr))
+ cdr))
{
if (TAO_debug_level > 3)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%P|%t) Error in writing GIOP header \n")),
- -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Error in writing GIOP header \n")),
+ -1);
}
// Now call the implementation for the rest of the header
if (!this->generator_parser_->write_request_header (op,
- spec,
- cdr))
+ spec,
+ cdr))
{
if (TAO_debug_level > 4)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%P|%t) Error in writing request header \n")),
- -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Error in writing request header \n")),
+ -1);
}
return 0;
@@ -121,12 +121,12 @@ TAO_GIOP_Message_Base::generate_locate_request_header (
{
// Write the GIOP header first
if (!this->write_protocol_header (TAO_GIOP_LOCATEREQUEST,
- cdr))
+ cdr))
{
if (TAO_debug_level > 3)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%P|%t) Error in writing GIOP header \n")),
- -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Error in writing GIOP header \n")),
+ -1);
}
@@ -137,9 +137,9 @@ TAO_GIOP_Message_Base::generate_locate_request_header (
cdr))
{
if (TAO_debug_level > 4)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%P|%t) Error in writing locate request header \n")),
- -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Error in writing locate request header \n")),
+ -1);
}
return 0;
@@ -154,22 +154,22 @@ TAO_GIOP_Message_Base::generate_reply_header (
{
// Write the GIOP header first
if (!this->write_protocol_header (TAO_GIOP_REPLY,
- cdr))
+ cdr))
{
if (TAO_debug_level > 3)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%P|%t) Error in writing GIOP header \n")),
- -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Error in writing GIOP header \n")),
+ -1);
}
// Now call the implementation for the rest of the header
if (!this->generator_parser_->write_reply_header (cdr,
- params))
+ params))
{
if (TAO_debug_level > 4)
- ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%P|%t) Error in writing reply header \n")),
- -1);
+ ACE_ERROR_RETURN ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) Error in writing reply header \n")),
+ -1);
}
return 0;
@@ -178,23 +178,23 @@ TAO_GIOP_Message_Base::generate_reply_header (
int
TAO_GIOP_Message_Base::read_message (TAO_Transport *transport,
- int /*block */,
- ACE_Time_Value * /*max_wait_time*/)
+ int /*block */,
+ ACE_Time_Value * /*max_wait_time*/)
{
// Call the handler to read and do a simple parse of the header of
// the message.
- if (this->message_handler_.read_parse_message (transport) == -1)
+ if (this->message_handler_.read_parse_message (transport) == -1)
return -1;
// Get the message state
- TAO_GIOP_Message_State &state =
+ TAO_GIOP_Message_State &state =
this->message_handler_.message_state ();
// Set the state internally for parsing and generating messages
this->set_state (state.giop_version.major,
- state.giop_version.minor);
+ state.giop_version.minor);
- int retval = this->message_handler_.is_message_ready (transport);
+ int retval = this->message_handler_.is_message_ready (transport);
return retval;
}
@@ -204,48 +204,46 @@ int
TAO_GIOP_Message_Base::format_message (TAO_OutputCDR &stream)
{
// Get the header length
- const size_t header_len = TAO_GIOP_MESSAGE_HEADER_LEN ;
+ const size_t header_len = TAO_GIOP_MESSAGE_HEADER_LEN ;
// Get the message size offset
- const size_t offset = TAO_GIOP_MESSAGE_SIZE_OFFSET;
+ const size_t offset = TAO_GIOP_MESSAGE_SIZE_OFFSET;
// Ptr to first buffer.
char *buf = (char *) stream.buffer ();
// Length of all buffers.
size_t total_len =
- stream.total_length ();
+ stream.total_length ();
- // NOTE: Here would also be a fine place to calculate a digital
- // signature for the message and place it into a preallocated slot
- // in the "ServiceContext". Similarly, this is a good spot to
+ // NOTE: Here would also be a fine place to calculate a digital
+ // signature for the message and place it into a preallocated slot
+ // in the "ServiceContext". Similarly, this is a good spot to
// encrypt messages (or just the message bodies) if that's needed in
- // this particular environment and that isn't handled by the
- // networking infrastructure (e.g., IPSEC).
+ // this particular environment and that isn't handled by the
+ // networking infrastructure (e.g., IPSEC).
CORBA::ULong bodylen = total_len - header_len;
#if !defined (ACE_ENABLE_SWAP_ON_WRITE)
- *ACE_reinterpret_cast (CORBA::ULong *, buf + offset) = bodylen;
+ *ACE_reinterpret_cast (CORBA::ULong *, buf + offset) = bodylen;
#else
if (!stream.do_byte_swap ())
- *ACE_reinterpret_cast (CORBA::ULong *,
- buf + offset) = bodylen;
+ *ACE_reinterpret_cast (CORBA::ULong *,
+ buf + offset) = bodylen;
else
- ACE_CDR::swap_4 (ACE_reinterpret_cast (char *,
- &bodylen),
- buf + offset);
+ ACE_CDR::swap_4 (ACE_reinterpret_cast (char *,
+ &bodylen),
+ buf + offset);
#endif /* ACE_ENABLE_SWAP_ON_WRITE */
- // Strictly speaking, should not need to loop here because the
- // socket never gets set to a nonblocking mode ... some Linux
- // versions seem to need it though. Leaving it costs little.
- if (TAO_debug_level > 2)
+
+ if (TAO_debug_level > 2)
{
this->dump_msg ("send",
- ACE_reinterpret_cast (u_char *,
- buf),
- bodylen);
+ ACE_reinterpret_cast (u_char *,
+ buf),
+ bodylen);
}
return 0;
@@ -271,11 +269,11 @@ TAO_GIOP_Message_Base::message_type (void)
case TAO_GIOP_CANCELREQUEST:
case TAO_GIOP_MESSAGERROR:
case TAO_GIOP_FRAGMENT:
- // Never happens: why??
+ // Never happens: why??
default:
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("TAO (%P|%t) %N:%l message_type : ")
- ACE_TEXT ("wrong message.\n")));
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO (%P|%t) %N:%l message_type : ")
+ ACE_TEXT ("wrong message.\n")));
}
@@ -288,7 +286,7 @@ TAO_GIOP_Message_Base::message_type (void)
int
TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport,
- TAO_ORB_Core *orb_core)
+ TAO_ORB_Core *orb_core)
{
// Set the upcall thread
orb_core->leader_follower ().set_upcall_thread ();
@@ -298,57 +296,57 @@ TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport,
this->output_->reset ();
/************************************************************/
- // @@ This comment was there when we were using multiple reads. Let
- // it be here till a point it doesn't make sense _ bala
+ // @@ This comment was there when we were using multiple reads. Let
+ // it be here till a point it doesn't make sense _ bala
// Take out all the information from the <message_state> and reset
- // it so that nested upcall on the same transport can be handled.
+ // it so that nested upcall on the same transport can be handled.
//
// Notice that the message_state is only modified in one thread at a
// time because the reactor does not call handle_input() for the
- // same Event_Handler in two threads at the same time.
+ // same Event_Handler in two threads at the same time.
/************************************************************/
- // Create a message block by stealing the data block
+ // Create a message block by stealing the data block
ACE_Message_Block msg_block (this->message_handler_.data_block_dup ());
- // Move the wr_ptr () and rd_ptr in the message block. This is not
- // generally required as we are not going to write anything. But
- // this is *important* for checking the length of the CDR streams
+ // Move the wr_ptr () and rd_ptr in the message block. This is not
+ // generally required as we are not going to write anything. But
+ // this is *important* for checking the length of the CDR streams
msg_block.wr_ptr (this->message_handler_.wr_pos ());
msg_block.rd_ptr (this->message_handler_.rd_pos ());
// Steal the input CDR from the message block
TAO_InputCDR input_cdr (&msg_block,
- this->message_handler_.message_state ().byte_order,
- orb_core);
+ this->message_handler_.message_state ().byte_order,
+ orb_core);
- // Send the message state for the service layer like FT to log the
+ // Send the message state for the service layer like FT to log the
// messages
- // @@@ Needed for DOORS
+ // @@@ Needed for DOORS
// orb_core->services_log_msg_rcv (this->message_state_);
// Reset the message handler to receive upcalls if any
this->message_handler_.reset (0);
- // We know we have some request message. Check whether it is a
+ // We know we have some request message. Check whether it is a
// GIOP_REQUEST or GIOP_LOCATE_REQUEST to take action.
switch (this->message_handler_.message_state ().message_type)
{
case TAO_GIOP_REQUEST:
- // Should be taken care by the state specific invocations. They
- // could raise an exception or write things in the output CDR
+ // Should be taken care by the state specific invocations. They
+ // could raise an exception or write things in the output CDR
// stream
return this->process_request (transport,
- orb_core,
- input_cdr);
+ orb_core,
+ input_cdr);
case TAO_GIOP_LOCATEREQUEST:
return this->process_locate_request (transport,
- orb_core,
- input_cdr);
+ orb_core,
+ input_cdr);
default:
return -1;
}
@@ -359,70 +357,70 @@ TAO_GIOP_Message_Base::process_reply_message (
TAO_Pluggable_Reply_Params &params
)
{
- // Create a message block by stealing the data block
+ // Create a message block by stealing the data block
ACE_Message_Block msg_block (this->message_handler_.data_block_dup ());
- // Move the wr_ptr () and rd_ptr in the message block. This is not
- // generally required as we are not going to write anything. But
- // this is *important* for checking the length of the CDR streams
+ // Move the wr_ptr () and rd_ptr in the message block. This is not
+ // generally required as we are not going to write anything. But
+ // this is *important* for checking the length of the CDR streams
size_t n = this->message_handler_.message_state ().message_size;
- msg_block.wr_ptr (n + TAO_GIOP_MESSAGE_HEADER_LEN);
+ msg_block.wr_ptr (n + TAO_GIOP_MESSAGE_HEADER_LEN);
msg_block.rd_ptr (TAO_GIOP_MESSAGE_HEADER_LEN);
// Steal the input CDR from the message block
- int byte_order = this->message_handler_.message_state ().byte_order;
+ int byte_order = this->message_handler_.message_state ().byte_order;
TAO_InputCDR input_cdr (&msg_block, byte_order);
- // Reset the message state. Now, we are ready for the next nested
+ // Reset the message state. Now, we are ready for the next nested
// upcall if any.
this->message_handler_.reset (0);
- // We know we have some reply message. Check whether it is a
- // GIOP_REPLY or GIOP_LOCATE_REPLY to take action.
+ // We know we have some reply message. Check whether it is a
+ // GIOP_REPLY or GIOP_LOCATE_REPLY to take action.
switch (this->message_handler_.message_state ().message_type)
{
case TAO_GIOP_REPLY:
- // Should be taken care by the state specific parsing
+ // Should be taken care by the state specific parsing
return this->generator_parser_->parse_reply (input_cdr,
- params);
+ params);
case TAO_GIOP_LOCATEREPLY:
return this->generator_parser_->parse_locate_reply (input_cdr,
- params);
+ params);
default:
- return -1;
+ return -1;
}
}
int
-TAO_GIOP_Message_Base::generate_exception_reply (
+TAO_GIOP_Message_Base::generate_exception_reply (
TAO_OutputCDR &cdr,
TAO_Pluggable_Reply_Params &params,
CORBA::Exception &x
)
{
- // A new try/catch block, but if something goes wrong now we have no
- // hope, just abort.
+ // A new try/catch block, but if something goes wrong now we have no
+ // hope, just abort.
ACE_DECLARE_NEW_CORBA_ENV;
ACE_TRY
{
// Make the GIOP & reply header.
this->generate_reply_header (cdr,
- params);
+ params);
x._tao_encode (cdr, ACE_TRY_ENV);
ACE_TRY_CHECK;
}
ACE_CATCH (CORBA_Exception, ex)
{
- // Now we know that while handling the error an other error
- // happened -> no hope, close connection.
+ // Now we know that while handling the error an other error
+ // happened -> no hope, close connection.
// Close the handle.
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P|%t|%N|%l) cannot marshal exception, ")
- ACE_TEXT ("generate_exception_reply ()")));
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P|%t|%N|%l) cannot marshal exception, ")
+ ACE_TEXT ("generate_exception_reply ()")));
return -1;
}
ACE_ENDTRY;
@@ -442,7 +440,7 @@ TAO_GIOP_Message_Base::write_protocol_header (
static CORBA::Octet magic[] =
{
- // The following works on non-ASCII platforms, such as MVS (which
+ // The following works on non-ASCII platforms, such as MVS (which
// uses EBCDIC).
0x47, // 'G'
0x49, // 'I'
@@ -450,13 +448,13 @@ TAO_GIOP_Message_Base::write_protocol_header (
0x50, // 'P'
};
- static int magic_size = sizeof (magic)/sizeof (magic[0]);
+ static int magic_size = sizeof (magic)/sizeof (magic[0]);
- msg.write_octet_array (magic, magic_size);
+ msg.write_octet_array (magic, magic_size);
msg.write_octet (this->generator_parser_->major_version ());
msg.write_octet (this->generator_parser_->minor_version ());
- // We are putting the byte order. But at a later date if we support
+ // We are putting the byte order. But at a later date if we support
// fragmentation and when we want to use the other 6 bits in this
// octet we can have a virtual function do this for us as the
// version info , Bala
@@ -464,7 +462,7 @@ TAO_GIOP_Message_Base::write_protocol_header (
msg.write_octet ((CORBA::Octet) t);
- // Write a dummy <size> later it is set to the right value...
+ // Write a dummy <size> later it is set to the right value...
CORBA::ULong size = 0;
msg.write_ulong (size);
@@ -475,16 +473,16 @@ TAO_GIOP_Message_Base::write_protocol_header (
int
TAO_GIOP_Message_Base::process_request (TAO_Transport *transport,
- TAO_ORB_Core *orb_core,
- TAO_InputCDR &cdr)
+ TAO_ORB_Core *orb_core,
+ TAO_InputCDR &cdr)
{
// This will extract the request header, set <response_required>
// and <sync_with_server> as appropriate.
TAO_ServerRequest request (this,
- cdr,
- *this->output_,
- transport,
- orb_core);
+ cdr,
+ *this->output_,
+ transport,
+ orb_core);
CORBA::Environment &ACE_TRY_ENV = TAO_default_environment ();
@@ -497,158 +495,158 @@ TAO_GIOP_Message_Base::process_request (TAO_Transport *transport,
ACE_TRY
{
parse_error =
- this->generator_parser_->parse_request_header (request);
+ this->generator_parser_->parse_request_header (request);
// Throw an exception if the
if (parse_error != 0)
- ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE,
- CORBA::COMPLETED_NO));
+ ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE,
+ CORBA::COMPLETED_NO));
request_id = request.request_id ();
- response_required = request.response_expected ();
+ response_required = request.response_expected ();
- CORBA::Object_var forward_to;
+ CORBA::Object_var forward_to;
- // Do this before the reply is sent.
+ // Do this before the reply is sent.
orb_core->adapter_registry ()->dispatch (request.object_key (),
- request,
- 0,
- forward_to,
- ACE_TRY_ENV);
+ request,
+ 0,
+ forward_to,
+ ACE_TRY_ENV);
ACE_TRY_CHECK;
- if (!CORBA::is_nil (forward_to.in ()))
- {
- // We should forward to another object...
- TAO_Pluggable_Reply_Params reply_params (orb_core);
- reply_params.request_id_ = request_id;
- reply_params.reply_status_ = TAO_GIOP_LOCATION_FORWARD;
- reply_params.svc_ctx_.length (0);
-
- // Sending back the same service context list we received in the
- // Request. (Important for RT CORBA).
- reply_params.service_context_notowned (&request.service_info ());
-
- // Make the GIOP header and Reply header
- this->generate_reply_header (*this->output_,
- reply_params);
-
- *this->output_ << forward_to.in ();
-
- int result = transport->send_message (*this->output_);
- if (result == -1)
- {
- if (TAO_debug_level > 0)
- {
- // No exception but some kind of error, yet a
- // response is required.
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ")
- ACE_TEXT ("cannot send reply\n"),
- ACE_TEXT ("TAO_GIOP::process_server_message")));
- }
- }
- return result;
- }
+ if (!CORBA::is_nil (forward_to.in ()))
+ {
+ // We should forward to another object...
+ TAO_Pluggable_Reply_Params reply_params (orb_core);
+ reply_params.request_id_ = request_id;
+ reply_params.reply_status_ = TAO_GIOP_LOCATION_FORWARD;
+ reply_params.svc_ctx_.length (0);
+
+ // Sending back the same service context list we received in the
+ // Request. (Important for RT CORBA).
+ reply_params.service_context_notowned (&request.service_info ());
+
+ // Make the GIOP header and Reply header
+ this->generate_reply_header (*this->output_,
+ reply_params);
+
+ *this->output_ << forward_to.in ();
+
+ int result = transport->send_message (*this->output_);
+ if (result == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ // No exception but some kind of error, yet a
+ // response is required.
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ")
+ ACE_TEXT ("cannot send reply\n"),
+ ACE_TEXT ("TAO_GIOP::process_server_message")));
+ }
+ }
+ return result;
+ }
}
- // Only CORBA exceptions are caught here.
+ // Only CORBA exceptions are caught here.
ACE_CATCHANY
{
int result = 0;
if (response_required)
- {
- result = this->send_reply_exception (transport,
- orb_core,
- request_id,
- &request.service_info (),
- &ACE_ANY_EXCEPTION);
- if (result == -1)
- {
- if (TAO_debug_level > 0)
- {
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ")
- ACE_TEXT ("cannot send exception\n"),
- ACE_TEXT ("process_connector_request ()")));
- }
-
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "TAO: ");
- }
-
- }
+ {
+ result = this->send_reply_exception (transport,
+ orb_core,
+ request_id,
+ &request.service_info (),
+ &ACE_ANY_EXCEPTION);
+ if (result == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ")
+ ACE_TEXT ("cannot send exception\n"),
+ ACE_TEXT ("process_connector_request ()")));
+ }
+
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "TAO: ");
+ }
+
+ }
else if (TAO_debug_level > 0)
- {
- // It is unfotunate that an exception (probably a system
- // exception) was thrown by the upcall code (even by the
- // user) when the client was not expecting a response.
- // However, in this case, we cannot close the connection
- // down, since it really isn't the client's fault.
+ {
+ // It is unfotunate that an exception (probably a system
+ // exception) was thrown by the upcall code (even by the
+ // user) when the client was not expecting a response.
+ // However, in this case, we cannot close the connection
+ // down, since it really isn't the client's fault.
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("(%P|%t) exception thrown ")
- ACE_TEXT ("but client is not waiting a response\n")));
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t) exception thrown ")
+ ACE_TEXT ("but client is not waiting a response\n")));
- ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
- "TAO: ");
- }
+ ACE_PRINT_EXCEPTION (ACE_ANY_EXCEPTION,
+ "TAO: ");
+ }
return result;
}
#if defined (TAO_HAS_EXCEPTIONS)
ACE_CATCHALL
{
- // @@ TODO some c++ exception or another, but what do we do with
+ // @@ TODO some c++ exception or another, but what do we do with
// it?
- // We are supposed to map it into a CORBA::UNKNOWN exception.
+ // We are supposed to map it into a CORBA::UNKNOWN exception.
// BTW, this cannot be detected if using the <env> mapping. If
- // we have native exceptions but no support for them in the ORB
- // we should still be able to catch it. If we don't have native
- // exceptions it couldn't have been raised in the first place!
+ // we have native exceptions but no support for them in the ORB
+ // we should still be able to catch it. If we don't have native
+ // exceptions it couldn't have been raised in the first place!
int result = 0;
if (response_required)
- {
- CORBA::UNKNOWN exception (
- CORBA::SystemException::_tao_minor_code (
- TAO_UNHANDLED_SERVER_CXX_EXCEPTION,
- 0
- ),
- CORBA::COMPLETED_MAYBE
- );
-
- result = this->send_reply_exception (transport,
- orb_core,
- request_id,
- &request.service_info (),
- &exception);
- if (result == -1)
- {
- if (TAO_debug_level > 0)
- {
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ")
- ACE_TEXT ("cannot send exception\n"),
- ACE_TEXT ("process_connector_request ()")));
- }
-
- ACE_PRINT_EXCEPTION (exception, "TAO: ");
- }
- }
+ {
+ CORBA::UNKNOWN exception (
+ CORBA::SystemException::_tao_minor_code (
+ TAO_UNHANDLED_SERVER_CXX_EXCEPTION,
+ 0
+ ),
+ CORBA::COMPLETED_MAYBE
+ );
+
+ result = this->send_reply_exception (transport,
+ orb_core,
+ request_id,
+ &request.service_info (),
+ &exception);
+ if (result == -1)
+ {
+ if (TAO_debug_level > 0)
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO: (%P|%t|%N|%l) %p: ")
+ ACE_TEXT ("cannot send exception\n"),
+ ACE_TEXT ("process_connector_request ()")));
+ }
+
+ ACE_PRINT_EXCEPTION (exception, "TAO: ");
+ }
+ }
else if (TAO_debug_level > 0)
- {
- // It is unfotunate that an exception (probably a system
- // exception) was thrown by the upcall code (even by the
- // user) when the client was not expecting a response.
- // However, in this case, we cannot close the connection
- // down, since it really isn't the client's fault.
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("(%P|%t|%N|%l) exception thrown ")
- ACE_TEXT ("but client is not waiting a response\n")));
- }
+ {
+ // It is unfotunate that an exception (probably a system
+ // exception) was thrown by the upcall code (even by the
+ // user) when the client was not expecting a response.
+ // However, in this case, we cannot close the connection
+ // down, since it really isn't the client's fault.
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("(%P|%t|%N|%l) exception thrown ")
+ ACE_TEXT ("but client is not waiting a response\n")));
+ }
return result;
}
@@ -661,13 +659,13 @@ TAO_GIOP_Message_Base::process_request (TAO_Transport *transport,
int
TAO_GIOP_Message_Base::process_locate_request (TAO_Transport *transport,
- TAO_ORB_Core* orb_core,
- TAO_InputCDR &input)
+ TAO_ORB_Core* orb_core,
+ TAO_InputCDR &input)
{
// This will extract the request header, set <response_required> as
// appropriate.
- TAO_GIOP_Locate_Request_Header locate_request (input,
- orb_core);
+ TAO_GIOP_Locate_Request_Header locate_request (input,
+ orb_core);
TAO_GIOP_Locate_Status_Msg status_info;
@@ -680,119 +678,119 @@ TAO_GIOP_Message_Base::process_locate_request (TAO_Transport *transport,
ACE_TRY
{
int parse_error =
- this->generator_parser_->parse_locate_header (locate_request);
+ this->generator_parser_->parse_locate_header (locate_request);
if (parse_error != 0)
- {
- ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE,
- CORBA::COMPLETED_NO));
- }
+ {
+ ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE,
+ CORBA::COMPLETED_NO));
+ }
- // Execute a fake request to find out if the object is there or
- // if the POA can activate it on demand...
+ // Execute a fake request to find out if the object is there or
+ // if the POA can activate it on demand...
char repbuf[ACE_CDR::DEFAULT_BUFSIZE];
TAO_OutputCDR dummy_output (repbuf,
- sizeof repbuf);
- // This output CDR is not used!
+ sizeof repbuf);
+ // This output CDR is not used!
TAO_ObjectKey tmp_key (locate_request.object_key ().length (),
- locate_request.object_key ().length (),
- locate_request.object_key ().get_buffer (),
- 0);
+ locate_request.object_key ().length (),
+ locate_request.object_key ().get_buffer (),
+ 0);
- // Set it to an error state
+ // Set it to an error state
parse_error = 1;
CORBA::ULong req_id = locate_request.request_id ();
// We will send the reply. The ServerRequest class need not send
// the reply
CORBA::Boolean deferred_reply = 1;
- TAO_ServerRequest server_request (this,
- req_id,
- response_required,
- deferred_reply,
- tmp_key,
- "_non_existent",
- dummy_output,
- transport,
- orb_core,
- parse_error);
+ TAO_ServerRequest server_request (this,
+ req_id,
+ response_required,
+ deferred_reply,
+ tmp_key,
+ "_non_existent",
+ dummy_output,
+ transport,
+ orb_core,
+ parse_error);
if (parse_error != 0)
- {
- ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE,
- CORBA::COMPLETED_NO));
- }
+ {
+ ACE_TRY_THROW (CORBA::MARSHAL (TAO_DEFAULT_MINOR_CODE,
+ CORBA::COMPLETED_NO));
+ }
- CORBA::Object_var forward_to;
+ CORBA::Object_var forward_to;
orb_core->adapter_registry ()->dispatch (server_request.object_key (),
- server_request,
- 0,
- forward_to,
- ACE_TRY_ENV);
+ server_request,
+ 0,
+ forward_to,
+ ACE_TRY_ENV);
ACE_TRY_CHECK;
- if (!CORBA::is_nil (forward_to.in ()))
- {
- status_info.status = TAO_GIOP_OBJECT_FORWARD;
- status_info.forward_location_var = forward_to;
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("handle_locate has been called: forwarding\n")));
- }
- else if (server_request.exception_type () == TAO_GIOP_NO_EXCEPTION)
- {
- // We got no exception, so the object is here.
- status_info.status = TAO_GIOP_OBJECT_HERE;
- if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO: (%P|%t) handle_locate() : found\n")));
- }
+ if (!CORBA::is_nil (forward_to.in ()))
+ {
+ status_info.status = TAO_GIOP_OBJECT_FORWARD;
+ status_info.forward_location_var = forward_to;
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("handle_locate has been called: forwarding\n")));
+ }
+ else if (server_request.exception_type () == TAO_GIOP_NO_EXCEPTION)
+ {
+ // We got no exception, so the object is here.
+ status_info.status = TAO_GIOP_OBJECT_HERE;
+ if (TAO_debug_level > 0)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO: (%P|%t) handle_locate() : found\n")));
+ }
else
- {
- status_info.forward_location_var = server_request.forward_location ();
-
- if (!CORBA::is_nil (status_info.forward_location_var.in ()))
- {
- status_info.status = TAO_GIOP_OBJECT_FORWARD;
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("handle_locate has been called: forwarding\n")));
- }
- else
- {
- // Normal exception, so the object is not here
- status_info.status = TAO_GIOP_UNKNOWN_OBJECT;
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("handle_locate has been called: not here\n")));
- }
- }
+ {
+ status_info.forward_location_var = server_request.forward_location ();
+
+ if (!CORBA::is_nil (status_info.forward_location_var.in ()))
+ {
+ status_info.status = TAO_GIOP_OBJECT_FORWARD;
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("handle_locate has been called: forwarding\n")));
+ }
+ else
+ {
+ // Normal exception, so the object is not here
+ status_info.status = TAO_GIOP_UNKNOWN_OBJECT;
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("handle_locate has been called: not here\n")));
+ }
+ }
}
ACE_CATCHANY
{
- // Normal exception, so the object is not here
+ // Normal exception, so the object is not here
status_info.status = TAO_GIOP_UNKNOWN_OBJECT;
if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO (%P|%t) TAO_GIOP::process_server_locate - ")
- ACE_TEXT ("CORBA exception raised\n")));
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) TAO_GIOP::process_server_locate - ")
+ ACE_TEXT ("CORBA exception raised\n")));
}
#if defined (TAO_HAS_EXCEPTIONS)
ACE_CATCHALL
{
- // Normal exception, so the object is not here
+ // Normal exception, so the object is not here
status_info.status = TAO_GIOP_UNKNOWN_OBJECT;
if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO (%P|%t) TAO_GIOP::process_server_locate - ")
- ACE_TEXT ("C++ exception raised\n")));
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) TAO_GIOP::process_server_locate - ")
+ ACE_TEXT ("C++ exception raised\n")));
}
#endif /* TAO_HAS_EXCEPTIONS */
ACE_ENDTRY;
return this->make_send_locate_reply (transport,
- locate_request,
- status_info);
+ locate_request,
+ status_info);
}
@@ -804,46 +802,46 @@ TAO_GIOP_Message_Base::make_send_locate_reply (
TAO_GIOP_Locate_Status_Msg &status_info
)
{
- // Note here we are making the Locate reply header which is *QUITE*
- // different from the reply header made by the make_reply () call..
+ // Note here we are making the Locate reply header which is *QUITE*
+ // different from the reply header made by the make_reply () call..
// Make the GIOP message header
this->write_protocol_header (TAO_GIOP_LOCATEREPLY,
- *this->output_);
+ *this->output_);
// This writes the header & body
this->generator_parser_->write_locate_reply_mesg (*this->output_,
- request.request_id (),
- status_info);
+ request.request_id (),
+ status_info);
// Send the message
int result = transport->send_message (*this->output_);
- // Print out message if there is an error
- if (result == -1)
+ // Print out message if there is an error
+ if (result == -1)
{
if (TAO_debug_level > 0)
- {
- ACE_ERROR ((LM_ERROR,
- ACE_TEXT ("TAO: (%P|%t) %p: cannot send reply\n"),
- ACE_TEXT ("TAO_GIOP::process_server_message")));
- }
+ {
+ ACE_ERROR ((LM_ERROR,
+ ACE_TEXT ("TAO: (%P|%t) %p: cannot send reply\n"),
+ ACE_TEXT ("TAO_GIOP::process_server_message")));
+ }
}
return result;
}
-// Send an "I can't understand you" message -- again, the message is
-// prefabricated for simplicity. This implies abortive disconnect (at
-// the application level, if not at the level of TCP).
+// Send an "I can't understand you" message -- again, the message is
+// prefabricated for simplicity. This implies abortive disconnect (at
+// the application level, if not at the level of TCP).
//
-// NOTE that IIOP will still benefit from TCP's orderly disconnect.
+// NOTE that IIOP will still benefit from TCP's orderly disconnect.
int
TAO_GIOP_Message_Base::send_error (TAO_Transport *transport)
{
- const char
- error_message [TAO_GIOP_MESSAGE_HEADER_LEN] =
+ const char
+ error_message [TAO_GIOP_MESSAGE_HEADER_LEN] =
{
- // The following works on non-ASCII platforms, such as MVS (which
+ // The following works on non-ASCII platforms, such as MVS (which
// uses EBCDIC).
0x47, // 'G'
0x49, // 'I'
@@ -856,32 +854,32 @@ TAO_GIOP_Message_Base::send_error (TAO_Transport *transport)
0, 0, 0, 0
};
- // @@ Q: How does this works with GIOP lite?
- // A: It doesn't
+ // @@ Q: How does this works with GIOP lite?
+ // A: It doesn't
this->dump_msg ("send_error",
- (const u_char *) error_message,
- TAO_GIOP_MESSAGE_HEADER_LEN );
+ (const u_char *) error_message,
+ TAO_GIOP_MESSAGE_HEADER_LEN );
ACE_HANDLE which = transport->handle ();
ACE_Data_Block data_block (TAO_GIOP_MESSAGE_HEADER_LEN,
- ACE_Message_Block::MB_DATA,
- error_message,
- 0,
- 0,
- ACE_Message_Block::DONT_DELETE,
- 0);
+ ACE_Message_Block::MB_DATA,
+ error_message,
+ 0,
+ 0,
+ ACE_Message_Block::DONT_DELETE,
+ 0);
ACE_Message_Block message_block(&data_block);
message_block.wr_ptr (TAO_GIOP_MESSAGE_HEADER_LEN);
int result = transport->send (&message_block);
- if (result == -1)
+ if (result == -1)
{
if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO (%N|%l|%P|%t) error sending error to %d\n"),
- which));
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%N|%l|%P|%t) error sending error to %d\n"),
+ which));
}
return result;
@@ -890,39 +888,39 @@ TAO_GIOP_Message_Base::send_error (TAO_Transport *transport)
void
TAO_GIOP_Message_Base::set_state (CORBA::Octet def_major,
- CORBA::Octet def_minor)
+ CORBA::Octet def_minor)
{
// @@Bala Need to find a better way
- // @@ Bala: what about a table:
+ // @@ Bala: what about a table:
// Accept_State implementations[] = {
// Version_10,
// Version_11
// };
// this->accept_state_ = &implementations[def_minor];
- // @@ of course it requires range checking and the array must be in
- // some place where it is not detroyed too soon...
- // @@ I'm not sure if this implementations should be dynamically
+ // @@ of course it requires range checking and the array must be in
+ // some place where it is not detroyed too soon...
+ // @@ I'm not sure if this implementations should be dynamically
// loaded.
switch (def_major)
{
case 1:
switch (def_minor)
- {
- case 0:
- this->generator_parser_ =
- &this->tao_giop_impl_.tao_giop_10;
- break;
- case 1:
- this->generator_parser_ =
- &this->tao_giop_impl_.tao_giop_11;
- break;
- case 2:
- this->generator_parser_ =
- &this->tao_giop_impl_.tao_giop_12;
- break;
- default:
- break;
- }
+ {
+ case 0:
+ this->generator_parser_ =
+ &this->tao_giop_impl_.tao_giop_10;
+ break;
+ case 1:
+ this->generator_parser_ =
+ &this->tao_giop_impl_.tao_giop_11;
+ break;
+ case 2:
+ this->generator_parser_ =
+ &this->tao_giop_impl_.tao_giop_12;
+ break;
+ default:
+ break;
+ }
break;
default:
break;
@@ -930,34 +928,34 @@ TAO_GIOP_Message_Base::set_state (CORBA::Octet def_major,
}
-// Server sends an "I'm shutting down now, any requests you've sent me
+// Server sends an "I'm shutting down now, any requests you've sent me
// can be retried" message to the server. The message is prefab, for
// simplicity.
//
// NOTE: this is IIOP-specific though it doesn't look like it is. It
-// relies on a TCP-ism: orderly disconnect, which doesn't exist in all
-// transport protocols. Versions of GIOP atop some transport that's
+// relies on a TCP-ism: orderly disconnect, which doesn't exist in all
+// transport protocols. Versions of GIOP atop some transport that's
// lacking orderly disconnect must define some transport-specific
-// handshaking (e.g. the XNS/SPP handshake convention) in order to
-// know that the same transport semantics are provided when shutdown
+// handshaking (e.g. the XNS/SPP handshake convention) in order to
+// know that the same transport semantics are provided when shutdown
// is begun with messages "in flight". (IIOP doesn't report false
-// errors in the case of "clean shutdown", because it relies on
-// orderly disconnect as provided by TCP. This quality of service is
-// required to write robust distributed systems.)
+// errors in the case of "clean shutdown", because it relies on
+// orderly disconnect as provided by TCP. This quality of service is
+// required to write robust distributed systems.)
void
TAO_GIOP_Message_Base::
- send_close_connection (const TAO_GIOP_Version &version,
- TAO_Transport *transport,
- void *)
+ send_close_connection (const TAO_GIOP_Version &version,
+ TAO_Transport *transport,
+ void *)
{
// static CORBA::Octet
- // I hate this in every method. Till the time I figure out a way
+ // I hate this in every method. Till the time I figure out a way
// around I will have them here hanging around.
- const char close_message [TAO_GIOP_MESSAGE_HEADER_LEN] =
+ const char close_message [TAO_GIOP_MESSAGE_HEADER_LEN] =
{
- // The following works on non-ASCII platforms, such as MVS (which
+ // The following works on non-ASCII platforms, such as MVS (which
// uses EBCDIC).
0x47, // 'G'
0x49, // 'I'
@@ -970,48 +968,48 @@ TAO_GIOP_Message_Base::
0, 0, 0, 0
};
- // It's important that we use a reliable shutdown after we send this
+ // It's important that we use a reliable shutdown after we send this
// message, so we know it's received.
//
- // @@ should recv and discard queued data for portability; note
- // that this won't block (long) since we never set SO_LINGER
+ // @@ should recv and discard queued data for portability; note
+ // that this won't block (long) since we never set SO_LINGER
this->dump_msg ("send_close_connection",
- (const u_char *) close_message,
- TAO_GIOP_MESSAGE_HEADER_LEN);
+ (const u_char *) close_message,
+ TAO_GIOP_MESSAGE_HEADER_LEN);
ACE_HANDLE which = transport->handle ();
if (which == ACE_INVALID_HANDLE)
{
if (TAO_debug_level > 0)
- ACE_DEBUG ((LM_DEBUG,
- "TAO (%P|%t) TAO_GIOP::send_close_connection -"
- " connection already closed\n"));
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO (%P|%t) TAO_GIOP::send_close_connection -"
+ " connection already closed\n"));
return;
}
ACE_Data_Block data_block (TAO_GIOP_MESSAGE_HEADER_LEN,
- ACE_Message_Block::MB_DATA,
- close_message,
- 0,
- 0,
- ACE_Message_Block::DONT_DELETE,
- 0);
+ ACE_Message_Block::MB_DATA,
+ close_message,
+ 0,
+ 0,
+ ACE_Message_Block::DONT_DELETE,
+ 0);
ACE_Message_Block message_block(&data_block);
message_block.wr_ptr (TAO_GIOP_MESSAGE_HEADER_LEN);
if (transport->send (&message_block) == -1)
{
if (TAO_orbdebug)
- ACE_ERROR ((LM_ERROR,
- "(%P|%t) error closing connection %d\n",
- which));
+ ACE_ERROR ((LM_ERROR,
+ "(%P|%t) error closing connection %d\n",
+ which));
}
transport->close_connection ();
ACE_DEBUG ((LM_DEBUG,
- "(%P|%t) shut down transport, handle %d\n",
- which));
+ "(%P|%t) shut down transport, handle %d\n",
+ which));
}
@@ -1028,51 +1026,51 @@ TAO_GIOP_Message_Base::send_reply_exception (
// Create a new output CDR stream
char repbuf[ACE_CDR::DEFAULT_BUFSIZE];
#if defined(ACE_HAS_PURIFY)
- (void) ACE_OS::memset (repbuf,
- '\0',
- sizeof repbuf);
+ (void) ACE_OS::memset (repbuf,
+ '\0',
+ sizeof repbuf);
#endif /* ACE_HAS_PURIFY */
- TAO_OutputCDR output (repbuf,
- sizeof repbuf,
- TAO_ENCAP_BYTE_ORDER,
- orb_core->output_cdr_buffer_allocator (),
- orb_core->output_cdr_dblock_allocator (),
- orb_core->orb_params ()->cdr_memcpy_tradeoff (),
- orb_core->to_iso8859 (),
- orb_core->to_unicode ());
+ TAO_OutputCDR output (repbuf,
+ sizeof repbuf,
+ TAO_ENCAP_BYTE_ORDER,
+ orb_core->output_cdr_buffer_allocator (),
+ orb_core->output_cdr_dblock_allocator (),
+ orb_core->orb_params ()->cdr_memcpy_tradeoff (),
+ orb_core->to_iso8859 (),
+ orb_core->to_unicode ());
TAO_Pluggable_Reply_Params reply_params (orb_core);
reply_params.request_id_ = request_id;
reply_params.svc_ctx_.length (0);
- // We are going to send some data
- reply_params.argument_flag_ = 1;
+ // We are going to send some data
+ reply_params.argument_flag_ = 1;
- // Send back the service context we received. (RTCORBA relies on
+ // Send back the service context we received. (RTCORBA relies on
// this).
- reply_params.service_context_notowned (svc_info);
+ reply_params.service_context_notowned (svc_info);
reply_params.reply_status_ = TAO_GIOP_USER_EXCEPTION;
- if (CORBA::SystemException::_downcast (x) != 0)
+ if (CORBA::SystemException::_downcast (x) != 0)
{
reply_params.reply_status_ = TAO_GIOP_SYSTEM_EXCEPTION;
}
if (this->generate_exception_reply (output,
- reply_params,
- *x) == -1)
+ reply_params,
+ *x) == -1)
return -1;
return transport->send_message (output);
}
void
-TAO_GIOP_Message_Base::dump_msg (const char *label,
- const u_char *ptr,
- size_t len)
+TAO_GIOP_Message_Base::dump_msg (const char *label,
+ const u_char *ptr,
+ size_t len)
{
- static const char digits [] = "0123456789ABCD";
+ static const char digits [] = "0123456789ABCD";
static const char *names [] =
{
"Request",
@@ -1090,8 +1088,8 @@ TAO_GIOP_Message_Base::dump_msg (const char *label,
// Message name.
const char *message_name = "UNKNOWN MESSAGE";
u_long slot = ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET];
- if (slot < sizeof (names)/sizeof(names[0]))
- message_name = names [slot];
+ if (slot < sizeof (names)/sizeof(names[0]))
+ message_name = names [slot];
// Byte order.
int byte_order = ptr[TAO_GIOP_MESSAGE_FLAGS_OFFSET] & 0x01;
@@ -1100,40 +1098,40 @@ TAO_GIOP_Message_Base::dump_msg (const char *label,
CORBA::ULong tmp = 0;
CORBA::ULong *id = &tmp;
- if (ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET] == TAO_GIOP_REQUEST ||
- ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET] == TAO_GIOP_REPLY)
- {
- // @@ Only works if ServiceContextList is empty....
- if (this->generator_parser_->minor_version () < 2)
- {
- id = ACE_reinterpret_cast (CORBA::ULong *,
- (char * ) (ptr + TAO_GIOP_MESSAGE_HEADER_LEN + 4));
-
- }
- else
- {
- id = ACE_reinterpret_cast (CORBA::ULong *,
- (char * ) (ptr + TAO_GIOP_MESSAGE_HEADER_LEN));
- }
- }
+ if (ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET] == TAO_GIOP_REQUEST ||
+ ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET] == TAO_GIOP_REPLY)
+ {
+ // @@ Only works if ServiceContextList is empty....
+ if (this->generator_parser_->minor_version () < 2)
+ {
+ id = ACE_reinterpret_cast (CORBA::ULong *,
+ (char * ) (ptr + TAO_GIOP_MESSAGE_HEADER_LEN + 4));
+
+ }
+ else
+ {
+ id = ACE_reinterpret_cast (CORBA::ULong *,
+ (char * ) (ptr + TAO_GIOP_MESSAGE_HEADER_LEN));
+ }
+ }
// Print.
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("(%P | %t):%s GIOP v%c.%c msg, ")
- ACE_TEXT ("%d data bytes, %s endian, %s = %d\n"),
- label,
- digits[ptr[TAO_GIOP_VERSION_MAJOR_OFFSET]],
- digits[ptr[TAO_GIOP_VERSION_MINOR_OFFSET]],
- len - TAO_GIOP_MESSAGE_HEADER_LEN ,
- (byte_order == TAO_ENCAP_BYTE_ORDER) ? "my" : "other",
- message_name,
- *id));
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("(%P | %t):%s GIOP v%c.%c msg, ")
+ ACE_TEXT ("%d data bytes, %s endian, %s = %d\n"),
+ label,
+ digits[ptr[TAO_GIOP_VERSION_MAJOR_OFFSET]],
+ digits[ptr[TAO_GIOP_VERSION_MINOR_OFFSET]],
+ len - TAO_GIOP_MESSAGE_HEADER_LEN ,
+ (byte_order == TAO_ENCAP_BYTE_ORDER) ? "my" : "other",
+ message_name,
+ *id));
if (TAO_debug_level >= 10)
- ACE_HEX_DUMP ((LM_DEBUG,
- (const char *) ptr,
- len,
- ACE_TEXT ("GIOP message")));
+ ACE_HEX_DUMP ((LM_DEBUG,
+ (const char *) ptr,
+ len,
+ ACE_TEXT ("GIOP message")));
}
@@ -1153,32 +1151,32 @@ TAO_GIOP_Message_Base::generate_locate_reply_header (
int
TAO_GIOP_Message_Base::is_ready_for_bidirectional (void)
{
- // We dont really know.. So ask the enerator and parser objects that
- // we know.
+ // We dont really know.. So ask the enerator and parser objects that
+ // we know.
return this->generator_parser_->is_ready_for_bidirectional ();
}
int
TAO_GIOP_Message_Base::more_messages (void)
{
- // Does the handler have more messages for processing?
- int retval = this->message_handler_.more_messages ();
+ // Does the handler have more messages for processing?
+ int retval = this->message_handler_.more_messages ();
- if (retval == TAO_MESSAGE_BLOCK_COMPLETE ||
- retval == TAO_MESSAGE_BLOCK_INCOMPLETE)
+ if (retval == TAO_MESSAGE_BLOCK_COMPLETE ||
+ retval == TAO_MESSAGE_BLOCK_INCOMPLETE)
return 1;
// Get the message state
- TAO_GIOP_Message_State &state =
+ TAO_GIOP_Message_State &state =
this->message_handler_.message_state ();
// Set the state internally for parsing and generating messages
this->set_state (state.giop_version.major,
- state.giop_version.minor);
+ state.giop_version.minor);
// retval = this->message_handler_.is_message_ready ();
- if (retval == 1)
+ if (retval == 1)
{
return TAO_MESSAGE_BLOCK_NEEDS_PROCESSING;
}
diff --git a/TAO/tao/GIOP_Message_Handler.cpp b/TAO/tao/GIOP_Message_Handler.cpp
index 965e73cb2ea..a5a98781e69 100644
--- a/TAO/tao/GIOP_Message_Handler.cpp
+++ b/TAO/tao/GIOP_Message_Handler.cpp
@@ -58,7 +58,7 @@ TAO_GIOP_Message_Handler::read_parse_message (TAO_Transport *transport)
if (TAO_debug_level > 8)
{
- ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - received %d bytes 1\n", n));
+ ACE_DEBUG ((LM_DEBUG, "TAO (%P|%t) - received %d bytes \n", n));
}
// Check what message are we waiting for and take suitable action
@@ -89,20 +89,21 @@ TAO_GIOP_Message_Handler::parse_header (void)
// Grab the read pointer
char *buf = this->current_buffer_.rd_ptr ();
- // Let us be specific that it is for 1.0
+ // Let us be specific that this is for 1.0
if (this->message_state_.giop_version.minor == 0 &&
- this->message_state_.giop_version.minor == 1)
+ this->message_state_.giop_version.major == 1)
{
this->message_state_.byte_order =
buf[TAO_GIOP_MESSAGE_FLAGS_OFFSET];
- if (TAO_debug_level > 2
- && this->message_state_.byte_order != 0 &&
+
+ if (this->message_state_.byte_order != 0 &&
this->message_state_.byte_order != 1)
{
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO (%P|%t) invalid byte order <%d>")
- ACE_TEXT (" for version <1.0>\n"),
- this->message_state_.byte_order));
+ if (TAO_debug_level > 2)
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO (%P|%t) invalid byte order <%d>")
+ ACE_TEXT (" for version <1.0>\n"),
+ this->message_state_.byte_order));
return -1;
}
}
@@ -116,9 +117,9 @@ TAO_GIOP_Message_Handler::parse_header (void)
this->message_state_.more_fragments =
(CORBA::Octet) (buf[TAO_GIOP_MESSAGE_FLAGS_OFFSET]& 0x02);
- if (TAO_debug_level > 2
- && (buf[TAO_GIOP_MESSAGE_FLAGS_OFFSET] & ~0x3) != 0)
+ if ((buf[TAO_GIOP_MESSAGE_FLAGS_OFFSET] & ~0x3) != 0)
{
+ if (TAO_debug_level > 2)
ACE_DEBUG ((LM_DEBUG,
ACE_TEXT ("TAO (%P|%t) invalid flags for <%d>")
ACE_TEXT (" for version <%d %d> \n"),
@@ -149,6 +150,8 @@ TAO_GIOP_Message_Handler::parse_header (void)
this->message_state_.message_size));
}
+ // By this point we are doubly sure that we have a more or less
+ // valid GIOP message with a valid major revisiosn number.
if (this->message_state_.more_fragments &&
this->message_state_.giop_version.minor == 2 &&
this->current_buffer_.length () > TAO_GIOP_MESSAGE_FRAGMENT_HEADER)
@@ -290,7 +293,7 @@ TAO_GIOP_Message_Handler::is_message_ready (TAO_Transport *transport)
"Recv msg",
ACE_reinterpret_cast (u_char *,
buf),
- this->message_state_.message_size);
+ len + TAO_GIOP_MESSAGE_HEADER_LEN);
return this->message_state_.is_complete (this->current_buffer_);
}
@@ -308,7 +311,8 @@ TAO_GIOP_Message_Handler::is_message_ready (TAO_Transport *transport)
"Recv msg",
ACE_reinterpret_cast (u_char *,
buf),
- this->message_state_.message_size);
+ this->message_state_.message_size +
+ TAO_GIOP_MESSAGE_HEADER_LEN);
this->supp_buffer_.data_block (
this->current_buffer_.data_block ()->clone ());
@@ -458,7 +462,8 @@ TAO_GIOP_Message_Handler::get_message (void)
"Recv msg",
ACE_reinterpret_cast (u_char *,
buf),
- this->message_state_.message_size);
+ this->message_state_.message_size +
+ TAO_GIOP_MESSAGE_HEADER_LEN);
this->supp_buffer_.rd_ptr (this->message_state_.message_size);
return this->message_state_.is_complete (this->current_buffer_);
@@ -483,7 +488,8 @@ TAO_GIOP_Message_Handler::get_message (void)
"Recv msg",
ACE_reinterpret_cast (u_char *,
buf),
- this->message_state_.message_size);
+ this->message_state_.message_size +
+ TAO_GIOP_MESSAGE_HEADER_LEN);
this->supp_buffer_.rd_ptr (this->message_state_.message_size);
return this->message_state_.is_complete (this->current_buffer_);