diff options
author | Johnny Willemsen <jwillemsen@remedy.nl> | 2007-09-26 18:12:47 +0000 |
---|---|---|
committer | Johnny Willemsen <jwillemsen@remedy.nl> | 2007-09-26 18:12:47 +0000 |
commit | 36d914efaa1147b677963ad89e1d767deb0dd27b (patch) | |
tree | f90be91b1a8184a7eb01709076a48abd0d16b57d /TAO/tao | |
parent | f3383cfe91f5f26b8d737904075e594aa06b2896 (diff) | |
download | ATCD-36d914efaa1147b677963ad89e1d767deb0dd27b.tar.gz |
Wed Sep 26 06:11:15 UTC 2007 Johnny Willemsen <jwillemsen@remedy.nl>
Diffstat (limited to 'TAO/tao')
-rw-r--r-- | TAO/tao/GIOP_Message_Base.cpp | 181 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Base.h | 6 | ||||
-rw-r--r-- | TAO/tao/IIOP_Transport.cpp | 4 | ||||
-rw-r--r-- | TAO/tao/Invocation_Adapter.cpp | 2 | ||||
-rw-r--r-- | TAO/tao/MCAST_Parser.cpp | 31 | ||||
-rw-r--r-- | TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.cpp | 24 |
6 files changed, 116 insertions, 132 deletions
diff --git a/TAO/tao/GIOP_Message_Base.cpp b/TAO/tao/GIOP_Message_Base.cpp index f3721aeeeb6..8f77605719e 100644 --- a/TAO/tao/GIOP_Message_Base.cpp +++ b/TAO/tao/GIOP_Message_Base.cpp @@ -254,7 +254,7 @@ TAO_GIOP_Message_Base::format_message (TAO_OutputCDR &stream) buf + TAO_GIOP_MESSAGE_SIZE_OFFSET); #endif /* ACE_ENABLE_SWAP_ON_WRITE */ - if (TAO_debug_level > 2) + if (TAO_debug_level >= 5) { // Check whether the output cdr stream is build up of multiple // messageblocks. If so, consolidate them to one block that can be @@ -590,11 +590,12 @@ TAO_GIOP_Message_Base::process_request_message (TAO_Transport *transport, size_t const wr_pos = qd->msg_block ()->wr_ptr () - qd->msg_block ()->base (); rd_pos += TAO_GIOP_MESSAGE_HEADER_LEN; - if (TAO_debug_level > 0) - this->dump_msg ("recv", - reinterpret_cast <u_char *> (qd->msg_block ()->rd_ptr ()), - qd->msg_block ()->length ()); - + if (TAO_debug_level >= 5) + { + this->dump_msg ("recv", + reinterpret_cast <u_char *> (qd->msg_block ()->rd_ptr ()), + qd->msg_block ()->length ()); + } // Create a input CDR stream. We do the following // 1 - If the incoming message block has a data block with a flag @@ -677,10 +678,12 @@ TAO_GIOP_Message_Base::process_reply_message ( size_t const wr_pos = qd->msg_block ()->wr_ptr () - qd->msg_block ()->base (); rd_pos += TAO_GIOP_MESSAGE_HEADER_LEN; - if (TAO_debug_level > 0) - this->dump_msg ("recv", - reinterpret_cast <u_char *> (qd->msg_block ()->rd_ptr ()), - qd->msg_block ()->length ()); + if (TAO_debug_level >= 5) + { + this->dump_msg ("recv", + reinterpret_cast <u_char *> (qd->msg_block ()->rd_ptr ()), + qd->msg_block ()->length ()); + } // Create a empty buffer on stack @@ -1208,9 +1211,12 @@ TAO_GIOP_Message_Base::send_error (TAO_Transport *transport) 0, 0, 0, 0 }; - this->dump_msg ("send_error", - (const u_char *) error_message, - TAO_GIOP_MESSAGE_HEADER_LEN); + if (TAO_debug_level >= 5) + { + this->dump_msg ("send_error", + reinterpret_cast <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, @@ -1315,9 +1321,12 @@ TAO_GIOP_Message_Base:: // @@ 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); + if (TAO_debug_level >= 5) + { + this->dump_msg ("send_close_connection", + reinterpret_cast <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() @@ -1407,87 +1416,83 @@ TAO_GIOP_Message_Base::dump_msg (const char *label, const u_char *ptr, size_t len) { - - if (TAO_debug_level >= 5) + static const char digits[] = "0123456789ABCD"; + static const char *names[] = { - static const char digits[] = "0123456789ABCD"; - static const char *names[] = + "Request", + "Reply", + "CancelRequest", + "LocateRequest", + "LocateReply", + "CloseConnection", + "MessageError", + "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]; + + // Byte order. + int byte_order = ptr[TAO_GIOP_MESSAGE_FLAGS_OFFSET] & 0x01; + + // Get the version info + CORBA::Octet major = ptr[TAO_GIOP_VERSION_MAJOR_OFFSET]; + CORBA::Octet minor = ptr[TAO_GIOP_VERSION_MINOR_OFFSET]; + + // request/reply id. + CORBA::ULong tmp = 0; + CORBA::ULong *id = &tmp; + char *tmp_id = 0; + + if (ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET] == GIOP::Request || + ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET] == GIOP::Reply || + ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET] == GIOP::Fragment) { - "Request", - "Reply", - "CancelRequest", - "LocateRequest", - "LocateReply", - "CloseConnection", - "MessageError", - "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]; - - // Byte order. - int byte_order = ptr[TAO_GIOP_MESSAGE_FLAGS_OFFSET] & 0x01; - - // Get the version info - CORBA::Octet major = ptr[TAO_GIOP_VERSION_MAJOR_OFFSET]; - CORBA::Octet minor = ptr[TAO_GIOP_VERSION_MINOR_OFFSET]; - - // request/reply id. - CORBA::ULong tmp = 0; - CORBA::ULong *id = &tmp; - char *tmp_id = 0; - - if (ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET] == GIOP::Request || - ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET] == GIOP::Reply || - ptr[TAO_GIOP_MESSAGE_TYPE_OFFSET] == GIOP::Fragment) - { - if (major == 1 && minor < 2) - { - // @@ Only works if ServiceContextList is empty.... - tmp_id = (char * ) (ptr + TAO_GIOP_MESSAGE_HEADER_LEN + 4); - } - else - { - tmp_id = (char * ) (ptr + TAO_GIOP_MESSAGE_HEADER_LEN); - } -#if !defined (ACE_DISABLE_SWAP_ON_READ) - if (byte_order == TAO_ENCAP_BYTE_ORDER) + if (major == 1 && minor < 2) { - id = reinterpret_cast <ACE_CDR::ULong*> (tmp_id); + // @@ Only works if ServiceContextList is empty.... + tmp_id = (char * ) (ptr + TAO_GIOP_MESSAGE_HEADER_LEN + 4); } else { - ACE_CDR::swap_4 (tmp_id, reinterpret_cast <char*> (id)); + tmp_id = (char * ) (ptr + TAO_GIOP_MESSAGE_HEADER_LEN); } +#if !defined (ACE_DISABLE_SWAP_ON_READ) + if (byte_order == TAO_ENCAP_BYTE_ORDER) + { + id = reinterpret_cast <ACE_CDR::ULong*> (tmp_id); + } + else + { + ACE_CDR::swap_4 (tmp_id, reinterpret_cast <char*> (id)); + } #else - id = reinterpret_cast <ACE_CDR::ULong*> (tmp_id); + id = reinterpret_cast <ACE_CDR::ULong*> (tmp_id); #endif /* ACE_DISABLE_SWAP_ON_READ */ - } + } - // Print. - ACE_DEBUG ((LM_DEBUG, - "TAO (%P|%t) - GIOP_Message_Base::dump_msg, " - "%s GIOP v%c.%c msg, %d data bytes, %s endian, " - "Type %s[%u]\n", - ACE_TEXT_CHAR_TO_TCHAR (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) ? ACE_TEXT("my") : ACE_TEXT("other"), - ACE_TEXT_CHAR_TO_TCHAR(message_name), - *id)); - - if (TAO_debug_level >= 10) - ACE_HEX_DUMP ((LM_DEBUG, - (const char *) ptr, - len, - ACE_TEXT ("GIOP message"))); - } + // Print. + ACE_DEBUG ((LM_DEBUG, + "TAO (%P|%t) - GIOP_Message_Base::dump_msg, " + "%s GIOP v%c.%c msg, %d data bytes, %s endian, " + "Type %s[%u]\n", + ACE_TEXT_CHAR_TO_TCHAR (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) ? ACE_TEXT("my") : ACE_TEXT("other"), + ACE_TEXT_CHAR_TO_TCHAR(message_name), + *id)); + + if (TAO_debug_level >= 10) + ACE_HEX_DUMP ((LM_DEBUG, + (const char *) ptr, + len, + ACE_TEXT ("GIOP message"))); } int @@ -1498,8 +1503,8 @@ TAO_GIOP_Message_Base::generate_locate_reply_header ( return 0; } -int -TAO_GIOP_Message_Base::is_ready_for_bidirectional (TAO_OutputCDR &msg) +bool +TAO_GIOP_Message_Base::is_ready_for_bidirectional (TAO_OutputCDR &msg) const { TAO_GIOP_Message_Version giop_version; diff --git a/TAO/tao/GIOP_Message_Base.h b/TAO/tao/GIOP_Message_Base.h index c486068cace..c86d01a088c 100644 --- a/TAO/tao/GIOP_Message_Base.h +++ b/TAO/tao/GIOP_Message_Base.h @@ -153,10 +153,9 @@ public: /// Is the messaging object ready for processing BiDirectional /// request/response? - int is_ready_for_bidirectional (TAO_OutputCDR &msg); - -protected: + bool is_ready_for_bidirectional (TAO_OutputCDR &msg) const; +private: /// Processes the GIOP_REQUEST messages int process_request (TAO_Transport *transport, TAO_InputCDR &input, @@ -217,7 +216,6 @@ protected: /// node of size @a sz. TAO_Queued_Data *make_queued_data (size_t sz); -private: /// Parse GIOP request-id of TAO_Queued_Data @a qd /// @return 0 on success, otherwise -1 int parse_request_id (const TAO_Queued_Data *qd, CORBA::ULong &request_id) const; diff --git a/TAO/tao/IIOP_Transport.cpp b/TAO/tao/IIOP_Transport.cpp index 893e248f909..a012e078930 100644 --- a/TAO/tao/IIOP_Transport.cpp +++ b/TAO/tao/IIOP_Transport.cpp @@ -313,9 +313,7 @@ TAO_IIOP_Transport::generate_request_header (TAO_Operation_Details &opdetails, opdetails.request_id (this->tms ()->request_id ()); } - return TAO_Transport::generate_request_header (opdetails, - spec, - msg); + return TAO_Transport::generate_request_header (opdetails, spec, msg); } int diff --git a/TAO/tao/Invocation_Adapter.cpp b/TAO/tao/Invocation_Adapter.cpp index 9e5c3bf4da4..8375055e311 100644 --- a/TAO/tao/Invocation_Adapter.cpp +++ b/TAO/tao/Invocation_Adapter.cpp @@ -233,7 +233,7 @@ namespace TAO (void) this->set_response_flags (stub, details); CORBA::Octet rflags = details.response_flags (); - bool block_connect = + bool const block_connect = rflags != static_cast<CORBA::Octet> (Messaging::SYNC_NONE) && rflags != static_cast<CORBA::Octet> (TAO::SYNC_DELAYED_BUFFERING); diff --git a/TAO/tao/MCAST_Parser.cpp b/TAO/tao/MCAST_Parser.cpp index cf5c1750874..5360db58617 100644 --- a/TAO/tao/MCAST_Parser.cpp +++ b/TAO/tao/MCAST_Parser.cpp @@ -354,8 +354,7 @@ TAO_MCAST_Parser::assign_to_variables (char const * mcast_name) */ ACE_CString mcast_name_cstring (mcast_name); - ACE_CString::size_type pos_colon1 = - mcast_name_cstring.find (':', 0); + ACE_CString::size_type pos_colon1 = mcast_name_cstring.find (':', 0); #if defined (ACE_HAS_IPV6) // IPv6 numeric address in host string? @@ -367,8 +366,7 @@ TAO_MCAST_Parser::assign_to_variables (char const * mcast_name) { // In this case we have to find the end of the numeric address and // start looking for the port separator from there. - ACE_CString::size_type const cp_pos = - mcast_name_cstring.find (']', 0); + ACE_CString::size_type const cp_pos = mcast_name_cstring.find (']', 0); if (cp_pos == 0) { // No valid IPv6 address specified. @@ -419,25 +417,21 @@ TAO_MCAST_Parser::assign_to_variables (char const * mcast_name) mcast_name_cstring.length() - pos_colon1); - ACE_CString::size_type const pos_colon2 = - mcast_name_cstring.find (':', 0); + ACE_CString::size_type const pos_colon2 = mcast_name_cstring.find (':', 0); if (pos_colon2 == 0) { - if (mcast_name_cstring.find ("InterfaceRepository") != - ACE_CString::npos) + if (mcast_name_cstring.find ("InterfaceRepository") != ACE_CString::npos) { this->mcast_port_ = TAO_DEFAULT_INTERFACEREPO_SERVER_REQUEST_PORT; } - else if (mcast_name_cstring.find ("ImplRepoService") != - ACE_CString::npos) + else if (mcast_name_cstring.find ("ImplRepoService") != ACE_CString::npos) { this->mcast_port_ = TAO_DEFAULT_IMPLREPO_SERVER_REQUEST_PORT; } - else if (mcast_name_cstring.find ("TradingService") != - ACE_CString::npos) + else if (mcast_name_cstring.find ("TradingService") != ACE_CString::npos) { this->mcast_port_ = TAO_DEFAULT_TRADING_SERVER_REQUEST_PORT; } @@ -445,8 +439,7 @@ TAO_MCAST_Parser::assign_to_variables (char const * mcast_name) else { int const the_port = - ACE_OS::atoi (mcast_name_cstring.substring (0, - pos_colon2).c_str ()); + ACE_OS::atoi (mcast_name_cstring.substring (0, pos_colon2).c_str ()); if (the_port > 0 && the_port < 0xffffL) this->mcast_port_ = the_port; @@ -459,16 +452,13 @@ TAO_MCAST_Parser::assign_to_variables (char const * mcast_name) ACE_CString::size_type const pos_colon3 = mcast_name_cstring.find (':', 0); - this->mcast_nic_ = - mcast_name_cstring.substring (0, - pos_colon3).c_str (); + this->mcast_nic_ = mcast_name_cstring.substring (0, pos_colon3).c_str (); mcast_name_cstring = mcast_name_cstring.substring (pos_colon3 + 1, mcast_name_cstring.length() - pos_colon3); - ACE_CString::size_type const pos_colon4 = - mcast_name_cstring.find ('/', 0); + ACE_CString::size_type const pos_colon4 = mcast_name_cstring.find ('/', 0); if (pos_colon4 != 0) { @@ -485,8 +475,7 @@ TAO_MCAST_Parser::assign_to_variables (char const * mcast_name) mcast_name_cstring.length() - pos_colon4); this->service_name_ = - mcast_name_cstring.substring (1, - mcast_name_cstring.length() - 1).c_str (); + mcast_name_cstring.substring (1, mcast_name_cstring.length() - 1).c_str (); } TAO_END_VERSIONED_NAMESPACE_DECL diff --git a/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.cpp b/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.cpp index 3fd78e8b6d8..26b2008a7c6 100644 --- a/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.cpp +++ b/TAO/tao/RTCORBA/RT_Invocation_Endpoint_Selectors.cpp @@ -159,9 +159,9 @@ TAO_RT_Invocation_Endpoint_Selector::endpoint_from_profile ( TAO_RT_Endpoint_Utils::policy ( TAO_CACHED_POLICY_RT_PRIORITY_BANDED_CONNECTION, r); - int all_endpoints_are_valid = 0; - int match_priority = 0; - int match_bands = 0; + bool all_endpoints_are_valid = false; + bool match_priority = false; + bool match_bands = false; CORBA::Short client_thread_priority = 0; CORBA::Short min_priority = 0; CORBA::Short max_priority = 0; @@ -185,7 +185,7 @@ TAO_RT_Invocation_Endpoint_Selector::endpoint_from_profile ( // No priority model policy (and no bands policy): all endpoints // are fair game. - all_endpoints_are_valid = 1; + all_endpoints_are_valid = true; } // If the priority model policy is set. else @@ -208,7 +208,7 @@ TAO_RT_Invocation_Endpoint_Selector::endpoint_from_profile ( if (!is_client_propagated) { // Server declared: all endpoints are fair game. - all_endpoints_are_valid = 1; + all_endpoints_are_valid = true; } // Client propagated. else @@ -216,8 +216,7 @@ TAO_RT_Invocation_Endpoint_Selector::endpoint_from_profile ( // Get client thread priority. int status = protocol_hooks->get_thread_CORBA_priority ( - client_thread_priority // side effect - ); + client_thread_priority); // side effect if (status == -1) { throw ::CORBA::DATA_CONVERSION ( @@ -231,7 +230,7 @@ TAO_RT_Invocation_Endpoint_Selector::endpoint_from_profile ( // Match the priority of the client thread with the // endpoint. - match_priority = 1; + match_priority = true; } // There are bands. else @@ -264,7 +263,7 @@ TAO_RT_Invocation_Endpoint_Selector::endpoint_from_profile ( } // Match the priority of the band with the endpoint. - match_bands = 1; + match_bands = true; } } } @@ -327,13 +326,8 @@ TAO_RT_Invocation_Endpoint_Selector::endpoint_from_profile ( (&banded_connection_descriptor_property); } - bool status = - r.try_connect (&rt_transport_descriptor, - val - ); - // Check if the invocation has completed. - if (status == true) + if (r.try_connect (&rt_transport_descriptor, val)) return 1; } |