diff options
Diffstat (limited to 'TAO/tao/GIOP_Message_Base.cpp')
-rw-r--r-- | TAO/tao/GIOP_Message_Base.cpp | 711 |
1 files changed, 355 insertions, 356 deletions
diff --git a/TAO/tao/GIOP_Message_Base.cpp b/TAO/tao/GIOP_Message_Base.cpp index 7299518bdcb..f8cf0afe7af 100644 --- a/TAO/tao/GIOP_Message_Base.cpp +++ b/TAO/tao/GIOP_Message_Base.cpp @@ -15,9 +15,7 @@ # include "GIOP_Message_Base.i" #endif /* __ACE_INLINE__ */ -ACE_RCSID (tao, - GIOP_Message_Base, - "$Id$") +ACE_RCSID(tao, GIOP_Message_Base, "$Id$") TAO_GIOP_Message_Base::TAO_GIOP_Message_Base (TAO_ORB_Core *orb_core, size_t input_cdr_size) @@ -31,18 +29,18 @@ TAO_GIOP_Message_Base::TAO_GIOP_Message_Base (TAO_ORB_Core *orb_core, { #if defined(ACE_HAS_PURIFY) (void) ACE_OS::memset (this->repbuf_, - '\0', - sizeof 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 ())); } @@ -65,11 +63,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 +87,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 +119,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 +135,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; @@ -151,22 +149,22 @@ TAO_GIOP_Message_Base::generate_reply_header (TAO_OutputCDR &cdr, { // 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; @@ -175,15 +173,13 @@ TAO_GIOP_Message_Base::generate_reply_header (TAO_OutputCDR &cdr, 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. - int retval = this->message_handler_.read_parse_message (transport); - - if (retval < 1) - return retval; + if (this->message_handler_.read_parse_message (transport) == -1) + return -1; // Get the message state TAO_GIOP_Message_State &state = @@ -191,9 +187,9 @@ TAO_GIOP_Message_Base::read_message (TAO_Transport *transport, // 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 (transport); + int retval = this->message_handler_.is_message_ready (transport); return retval; } @@ -219,15 +215,15 @@ TAO_GIOP_Message_Base::format_message (TAO_OutputCDR &stream) #if !defined (ACE_ENABLE_SWAP_ON_WRITE) *ACE_reinterpret_cast (CORBA::ULong *, buf + - TAO_GIOP_MESSAGE_SIZE_OFFSET) = bodylen; + TAO_GIOP_MESSAGE_SIZE_OFFSET) = bodylen; #else if (!stream.do_byte_swap ()) *ACE_reinterpret_cast (CORBA::ULong *, - buf + TAO_GIOP_MESSAGE_SIZE_OFFSET) = bodylen; + buf + TAO_GIOP_MESSAGE_SIZE_OFFSET) = bodylen; else ACE_CDR::swap_4 (ACE_reinterpret_cast (char *, - &bodylen), - buf + TAO_GIOP_MESSAGE_SIZE_OFFSET); + &bodylen), + buf + TAO_GIOP_MESSAGE_SIZE_OFFSET); #endif /* ACE_ENABLE_SWAP_ON_WRITE */ if (TAO_debug_level > 2) @@ -237,16 +233,16 @@ TAO_GIOP_Message_Base::format_message (TAO_OutputCDR &stream) // dumped ACE_Message_Block* consolidated_block = 0; if (stream.begin()->cont () != 0) - { - consolidated_block = new ACE_Message_Block; - ACE_CDR::consolidate (consolidated_block, stream.begin ()); - buf = (char *) (consolidated_block->rd_ptr ()); - } + { + consolidated_block = new ACE_Message_Block; + ACE_CDR::consolidate (consolidated_block, stream.begin ()); + buf = (char *) (consolidated_block->rd_ptr ()); + } /// this->dump_msg ("send", - ACE_reinterpret_cast (u_char *, - buf), - total_len); + ACE_reinterpret_cast (u_char *, + buf), + total_len); // delete consolidated_block; @@ -278,9 +274,9 @@ TAO_GIOP_Message_Base::message_type (void) case TAO_GIOP_FRAGMENT: // 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"))); } return TAO_PLUGGABLE_MESSAGE_MESSAGERROR; @@ -288,7 +284,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 (); @@ -320,8 +316,8 @@ TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport, // 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); // input_cdr.skip_bytes (TAO_GIOP_MESSAGE_HEADER_LEN); @@ -342,13 +338,13 @@ TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport, // 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; } @@ -388,13 +384,13 @@ TAO_GIOP_Message_Base::process_reply_message ( case TAO_GIOP_REPLY: // 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; } } @@ -411,7 +407,7 @@ TAO_GIOP_Message_Base::generate_exception_reply (TAO_OutputCDR &cdr, { // Make the GIOP & reply header. this->generate_reply_header (cdr, - params); + params); x._tao_encode (cdr, ACE_TRY_ENV); ACE_TRY_CHECK; } @@ -422,8 +418,8 @@ TAO_GIOP_Message_Base::generate_exception_reply (TAO_OutputCDR &cdr, // Close the handle. ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("(%P|%t|%N|%l) cannot marshal exception, ") - ACE_TEXT ("generate_exception_reply ()"))); + ACE_TEXT ("(%P|%t|%N|%l) cannot marshal exception, ") + ACE_TEXT ("generate_exception_reply ()"))); return -1; } ACE_ENDTRY; @@ -472,16 +468,16 @@ TAO_GIOP_Message_Base::write_protocol_header (TAO_GIOP_Message_Type t, 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::ULong request_id = 0; CORBA::Boolean response_required = 0; @@ -492,12 +488,12 @@ 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 (); @@ -506,44 +502,44 @@ TAO_GIOP_Message_Base::process_request (TAO_Transport *transport, // 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); - - // Send back the reply service context. - reply_params.service_context_notowned (&request.reply_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; - } + { + // 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); + + // Send back the reply service context. + reply_params.service_context_notowned (&request.reply_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. ACE_CATCHANY @@ -551,42 +547,42 @@ TAO_GIOP_Message_Base::process_request (TAO_Transport *transport, int result = 0; if (response_required) - { - result = this->send_reply_exception (transport, - orb_core, - request_id, - &request.reply_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.reply_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; } @@ -603,40 +599,40 @@ TAO_GIOP_Message_Base::process_request (TAO_Transport *transport, int result = 0; if (response_required) - { - CORBA::UNKNOWN exception (CORBA::SystemException::_tao_minor_code + { + 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.reply_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: "); - } - } + result = this->send_reply_exception (transport, + orb_core, + request_id, + &request.reply_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; } @@ -649,13 +645,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); + orb_core); TAO_GIOP_Locate_Status_Msg status_info; @@ -668,25 +664,25 @@ 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... char repbuf[ACE_CDR::DEFAULT_BUFSIZE]; TAO_OutputCDR dummy_output (repbuf, - sizeof repbuf); + 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 parse_error = 1; @@ -696,64 +692,64 @@ TAO_GIOP_Message_Base::process_locate_request (TAO_Transport *transport, // 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); + 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; 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"))); - } + { + 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"))); - } + { + // 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 @@ -761,9 +757,9 @@ TAO_GIOP_Message_Base::process_locate_request (TAO_Transport *transport, // 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 @@ -771,16 +767,16 @@ TAO_GIOP_Message_Base::process_locate_request (TAO_Transport *transport, // 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); } int @@ -792,12 +788,12 @@ TAO_GIOP_Message_Base::make_send_locate_reply (TAO_Transport *transport, // 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_); @@ -806,11 +802,11 @@ TAO_GIOP_Message_Base::make_send_locate_reply (TAO_Transport *transport, 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; @@ -841,29 +837,30 @@ TAO_GIOP_Message_Base::send_error (TAO_Transport *transport) }; // @@ Q: How does this works with GIOP lite? - // A: It doesn't + // 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_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); + size_t bt; + int result = transport->send_message_block_chain (&message_block, bt); if (result == -1) { if (TAO_debug_level > 0) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO (%N|%l|%P|%t) error sending error to transport %lu\n"), - transport->id ())); + ACE_DEBUG ((LM_DEBUG, + ACE_TEXT ("TAO (%N|%l|%P|%t) error sending error to transport %lu\n"), + transport->id ())); } return result; @@ -871,7 +868,7 @@ 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: @@ -888,22 +885,22 @@ TAO_GIOP_Message_Base::set_state (CORBA::Octet 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; @@ -929,8 +926,8 @@ TAO_GIOP_Message_Base::set_state (CORBA::Octet def_major, void TAO_GIOP_Message_Base:: send_close_connection (const TAO_GIOP_Version &version, - TAO_Transport *transport, - void *) + TAO_Transport *transport, + void *) { // static CORBA::Octet @@ -958,8 +955,8 @@ TAO_GIOP_Message_Base:: // 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); #if 0 // @@CJC I don't think we need this check b/c the transport's send() @@ -973,35 +970,37 @@ TAO_GIOP_Message_Base:: 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; } #endif 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 && errno != ENOENT) + size_t bt; + int result = transport->send_message_block_chain (&message_block, bt); + if (result == -1) { if (TAO_debug_level > 0) - ACE_ERROR ((LM_ERROR, - "(%P|%t) error closing connection %lu, errno = %d\n", - transport->id (), errno)); + ACE_ERROR ((LM_ERROR, + "(%P|%t) error closing connection %lu, errno = %d\n", + transport->id (), errno)); } transport->close_connection (); ACE_DEBUG ((LM_DEBUG, - "(%P|%t) shut down transport, handle %d\n", - transport-> id ())); + "(%P|%t) shut down transport, handle %d\n", + transport-> id ())); } @@ -1019,17 +1018,17 @@ TAO_GIOP_Message_Base::send_reply_exception ( char repbuf[ACE_CDR::DEFAULT_BUFSIZE]; #if defined(ACE_HAS_PURIFY) (void) ACE_OS::memset (repbuf, - '\0', - sizeof 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 ()); + 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; @@ -1050,8 +1049,8 @@ TAO_GIOP_Message_Base::send_reply_exception ( } if (this->generate_exception_reply (output, - reply_params, - *x) == -1) + reply_params, + *x) == -1) return -1; return transport->send_message (output); @@ -1059,8 +1058,8 @@ TAO_GIOP_Message_Base::send_reply_exception ( void TAO_GIOP_Message_Base::dump_msg (const char *label, - const u_char *ptr, - size_t len) + const u_char *ptr, + size_t len) { if (TAO_debug_level >= 5) @@ -1068,21 +1067,21 @@ TAO_GIOP_Message_Base::dump_msg (const char *label, static const char digits[] = "0123456789ABCD"; static const char *names[] = { - "Request", - "Reply", - "CancelRequest", - "LocateRequest", - "LocateReply", - "CloseConnection", + "Request", + "Reply", + "CancelRequest", + "LocateRequest", + "LocateReply", + "CloseConnection", "MessageError", - "Fragment" + "Fragment" }; // 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]; + message_name = names[slot]; // Byte order. int byte_order = ptr[TAO_GIOP_MESSAGE_FLAGS_OFFSET] & 0x01; @@ -1092,39 +1091,39 @@ TAO_GIOP_Message_Base::dump_msg (const char *label, 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)); - } - } + 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 = %u\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_TEXT ("(%P | %t): %s GIOP v%c.%c msg, ") + ACE_TEXT ("%d data bytes, %s endian, %s = %u\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"))); } } @@ -1160,7 +1159,7 @@ TAO_GIOP_Message_Base::more_messages (void) // 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 (); |