diff options
Diffstat (limited to 'TAO/tao/Strategies/DIOP_Connection_Handler.cpp')
-rw-r--r-- | TAO/tao/Strategies/DIOP_Connection_Handler.cpp | 75 |
1 files changed, 45 insertions, 30 deletions
diff --git a/TAO/tao/Strategies/DIOP_Connection_Handler.cpp b/TAO/tao/Strategies/DIOP_Connection_Handler.cpp index ca8f2f86d1f..7e140d3b5e5 100644 --- a/TAO/tao/Strategies/DIOP_Connection_Handler.cpp +++ b/TAO/tao/Strategies/DIOP_Connection_Handler.cpp @@ -130,23 +130,24 @@ TAO_DIOP_Connection_Handler::open (void*) TAO_Protocols_Hooks *tph = this->orb_core ()->get_protocols_hooks (); - bool const client = this->transport ()->opened_as () == TAO::TAO_CLIENT_ROLE; - - try + if (tph != 0) { - if (client) + try { - tph->client_protocol_properties_at_orb_level (protocol_properties); + if (this->transport ()->opened_as () == TAO::TAO_CLIENT_ROLE) + { + tph->client_protocol_properties_at_orb_level (protocol_properties); + } + else + { + tph->server_protocol_properties_at_orb_level (protocol_properties); + } } - else + catch (const ::CORBA::Exception&) { - tph->server_protocol_properties_at_orb_level (protocol_properties); + return -1; } } - catch ( ::CORBA::Exception&) - { - return -1; - } this->udp_socket_.open (this->local_addr_); @@ -258,27 +259,14 @@ TAO_DIOP_Connection_Handler::release_os_resources (void) } int -TAO_DIOP_Connection_Handler::set_dscp_codepoint (CORBA::Boolean set_network_priority) +TAO_DIOP_Connection_Handler::set_tos (int tos) { - int tos = IPDSFIELD_DSCP_DEFAULT << 2; - - if (set_network_priority) - { - TAO_Protocols_Hooks *tph = - this->orb_core ()->get_protocols_hooks (); - - CORBA::Long codepoint = - tph->get_dscp_codepoint (); - - tos = (int)(codepoint) << 2; - } - if (tos != this->dscp_codepoint_) { - int result = this->dgram ().set_option (IPPROTO_IP, - IP_TOS, - (int *) &tos , - (int) sizeof (tos)); + int const result = this->dgram ().set_option (IPPROTO_IP, + IP_TOS, + (int *) &tos , + (int) sizeof (tos)); if (TAO_debug_level) { @@ -293,9 +281,36 @@ TAO_DIOP_Connection_Handler::set_dscp_codepoint (CORBA::Boolean set_network_prio // On successful setting of TOS field. if (result == 0) this->dscp_codepoint_ = tos; - } + return 0; +} +int +TAO_DIOP_Connection_Handler::set_dscp_codepoint (CORBA::Long dscp) +{ + int tos = IPDSFIELD_DSCP_DEFAULT << 2; + tos = (int)(dscp) << 2; + this->set_tos (tos); + return 0; +} + +int +TAO_DIOP_Connection_Handler::set_dscp_codepoint (CORBA::Boolean set_network_priority) +{ + int tos = IPDSFIELD_DSCP_DEFAULT << 2; + + if (set_network_priority) + { + TAO_Protocols_Hooks *tph = this->orb_core ()->get_protocols_hooks (); + + if (tph != 0) + { + CORBA::Long codepoint = tph->get_dscp_codepoint (); + + tos = (int)(codepoint) << 2; + this->set_tos (tos); + } + } return 0; } |