summaryrefslogtreecommitdiff
path: root/TAO/tao/IIOP_Transport.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'TAO/tao/IIOP_Transport.cpp')
-rw-r--r--TAO/tao/IIOP_Transport.cpp242
1 files changed, 161 insertions, 81 deletions
diff --git a/TAO/tao/IIOP_Transport.cpp b/TAO/tao/IIOP_Transport.cpp
index 815d41e49b8..f2a65d9dc12 100644
--- a/TAO/tao/IIOP_Transport.cpp
+++ b/TAO/tao/IIOP_Transport.cpp
@@ -18,6 +18,7 @@
#include "tao/debug.h"
#include "tao/GIOP_Message_Base.h"
#include "tao/GIOP_Message_Lite.h"
+#include "tao/Adapter.h"
#if !defined (__ACE_INLINE__)
# include "tao/IIOP_Transport.i"
@@ -25,12 +26,11 @@
ACE_RCSID (tao, IIOP_Transport, "$Id$")
-
TAO_IIOP_Transport::TAO_IIOP_Transport (TAO_IIOP_Connection_Handler *handler,
- TAO_ORB_Core *orb_core,
- CORBA::Boolean flag)
+ TAO_ORB_Core *orb_core,
+ CORBA::Boolean flag)
: TAO_Transport (TAO_TAG_IIOP_PROFILE,
- orb_core)
+ orb_core)
, connection_handler_ (handler)
, messaging_object_ (0)
{
@@ -38,13 +38,13 @@ TAO_IIOP_Transport::TAO_IIOP_Transport (TAO_IIOP_Connection_Handler *handler,
{
// Use the lite version of the protocol
ACE_NEW (this->messaging_object_,
- TAO_GIOP_Message_Lite (orb_core));
+ TAO_GIOP_Message_Lite (orb_core));
}
else
{
// Use the normal GIOP object
ACE_NEW (this->messaging_object_,
- TAO_GIOP_Message_Base (orb_core));
+ TAO_GIOP_Message_Base (orb_core));
}
}
@@ -59,6 +59,12 @@ TAO_IIOP_Transport::event_handler_i (void)
return this->connection_handler_;
}
+TAO_IIOP_Connection_Handler *
+TAO_IIOP_Transport::connection_handler (void)
+{
+ return this->connection_handler_;
+}
+
TAO_Pluggable_Messaging *
TAO_IIOP_Transport::messaging_object (void)
{
@@ -67,11 +73,11 @@ TAO_IIOP_Transport::messaging_object (void)
ssize_t
TAO_IIOP_Transport::send_i (iovec *iov, int iovcnt,
- size_t &bytes_transferred,
- const ACE_Time_Value *max_wait_time)
+ size_t &bytes_transferred,
+ const ACE_Time_Value *max_wait_time)
{
ssize_t retval = this->connection_handler_->peer ().sendv (iov, iovcnt,
- max_wait_time);
+ max_wait_time);
if (retval > 0)
bytes_transferred = retval;
@@ -80,12 +86,12 @@ TAO_IIOP_Transport::send_i (iovec *iov, int iovcnt,
ssize_t
TAO_IIOP_Transport::recv_i (char *buf,
- size_t len,
- const ACE_Time_Value *max_wait_time)
+ size_t len,
+ const ACE_Time_Value *max_wait_time)
{
ssize_t n = this->connection_handler_->peer ().recv (buf,
- len,
- max_wait_time);
+ len,
+ max_wait_time);
// Do not print the error message if it is a timeout, which could
// occur in thread-per-connection.
@@ -94,16 +100,16 @@ TAO_IIOP_Transport::recv_i (char *buf,
errno != ETIME)
{
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO (%P|%t) - %p \n"),
- ACE_TEXT ("TAO - read message failure ")
- ACE_TEXT ("recv_i () \n")));
+ ACE_TEXT ("TAO (%P|%t) - %p \n"),
+ ACE_TEXT ("TAO - read message failure ")
+ ACE_TEXT ("recv_i () \n")));
}
// Error handling
if (n == -1)
{
if (errno == EWOULDBLOCK)
- return 0;
+ return 0;
return -1;
@@ -127,8 +133,8 @@ TAO_IIOP_Transport::register_handler_i (void)
if (TAO_debug_level > 4)
{
ACE_DEBUG ((LM_DEBUG,
- "TAO (%P|%t) - IIOP_Transport::register_handler %d\n",
- this->id ()));
+ "TAO (%P|%t) - IIOP_Transport::register_handler %d\n",
+ this->id ()));
}
ACE_Reactor *r = this->orb_core_->reactor ();
@@ -143,54 +149,85 @@ TAO_IIOP_Transport::register_handler_i (void)
// Register the handler with the reactor
return r->register_handler (this->connection_handler_,
- ACE_Event_Handler::READ_MASK);
+ ACE_Event_Handler::READ_MASK);
}
int
TAO_IIOP_Transport::send_request (TAO_Stub *stub,
- TAO_ORB_Core *orb_core,
- TAO_OutputCDR &stream,
- int two_way,
- ACE_Time_Value *max_wait_time)
+ TAO_ORB_Core *orb_core,
+ TAO_OutputCDR &stream,
+ int two_way,
+ ACE_Time_Value *max_wait_time)
{
+ TAO_Protocols_Hooks *tph = this->orb_core_->get_protocols_hooks (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+ if (tph != 0)
+ {
+ /*
+ int send_buffer_size;
+ int recv_buffer_size;
+ int no_delay;
+ int enable_network_priority;
+ */
+ const char protocol [] = "iiop";
+ const char *protocol_type = protocol;
+
+ int result =
+ tph->update_client_protocol_properties (stub,
+ this->connection_handler_,
+ protocol_type);
+
+ if (result == -1)
+ return -1;
+
+ }
+
if (this->ws_->sending_request (orb_core,
- two_way) == -1)
+ two_way) == -1)
return -1;
if (this->send_message (stream,
- stub,
- two_way,
- max_wait_time) == -1)
+ stub,
+ two_way,
+ max_wait_time) == -1)
return -1;
-
+
return this->idle_after_send ();
}
int
TAO_IIOP_Transport::send_message (TAO_OutputCDR &stream,
- TAO_Stub *stub,
- int twoway,
- ACE_Time_Value *max_wait_time)
+ TAO_Stub *stub,
+ int twoway,
+ ACE_Time_Value *max_wait_time)
{
+ if (TAO_debug_level)
+ ACE_DEBUG ((LM_DEBUG,
+ "TAO_IIOP_Transport::send_message\n enable_network_priority = %d\n",
+ this->connection_handler_->enable_network_priority ()));
+
+ this->connection_handler_->set_dscp_codepoint ();
+
// Format the message in the stream first
if (this->messaging_object_->format_message (stream) != 0)
return -1;
// This guarantees to send all data (bytes) or return an error.
ssize_t n = this->send_message_i (stub,
- twoway,
- stream.begin (),
- max_wait_time);
+ twoway,
+ stream.begin (),
+ max_wait_time);
if (n == -1)
{
if (TAO_debug_level)
- ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("TAO: (%P|%t|%N|%l) closing transport %d after fault %p\n"),
- this->id (),
- ACE_TEXT ("send_message ()\n")));
+ ACE_DEBUG ((LM_DEBUG,
+ ACE_TEXT ("TAO: (%P|%t|%N|%l) closing transport %d after fault %p\n"),
+ this->id (),
+ ACE_TEXT ("send_message ()\n")));
return -1;
}
@@ -198,10 +235,54 @@ TAO_IIOP_Transport::send_message (TAO_OutputCDR &stream,
return 1;
}
+/*
+int
+TAO_IIOP_Transport::send_reply (TAO_OutputCDR &stream,
+ TAO_Adapter *poa)
+{
+
+ TAO_Protocols_Hooks *tph = this->orb_core_->get_protocols_hooks (ACE_ENV_SINGLE_ARG_PARAMETER);
+ ACE_CHECK_RETURN (-1);
+
+
+ if (tph != 0)
+ {
+ int send_buffer_size;
+ int recv_buffer_size;
+ int no_delay;
+ int enable_network_priority;
+
+ const char protocol [] = "iiop";
+ const char *protocol_type = protocol;
+
+ int result =
+ tph->get_effective_server_protocol_properties (poa,
+ send_buffer_size,
+ recv_buffer_size,
+ no_delay,
+ enable_network_priority,
+ protocol_type);
+ if (result != 0)
+ ACE_ERROR_RETURN ((LM_ERROR,
+ "Error in getting the effective protocol properties\n"),
+ -1);
+
+ this->connection_handler_->update_protocol_properties (send_buffer_size,
+ recv_buffer_size,
+ no_delay,
+ enable_network_priority);
+ }
+
+ int result = this->send_message (stream);
+ return result;
+}
+
+ */
+
int
TAO_IIOP_Transport::generate_request_header (TAO_Operation_Details &opdetails,
- TAO_Target_Specification &spec,
- TAO_OutputCDR &msg)
+ TAO_Target_Specification &spec,
+ TAO_OutputCDR &msg)
{
// Check whether we have a Bi Dir IIOP policy set, whether the
// messaging objects are ready to handle bidirectional connections
@@ -215,25 +296,24 @@ TAO_IIOP_Transport::generate_request_header (TAO_Operation_Details &opdetails,
// Set the flag to 0 (i.e., originating side)
this->bidirectional_flag (0);
-
- // Modify the request id if we have BiDirectional client/server
- // setup.
- // @@ Is this needed at all?
- opdetails.modify_request_id (this->bidirectional_flag ());
}
+ // Modify the request id if we have BiDirectional client/server
+ // setup
+ opdetails.modify_request_id (this->bidirectional_flag ());
+
return TAO_Transport::generate_request_header (opdetails,
- spec,
- msg);
+ spec,
+ msg);
}
int
TAO_IIOP_Transport::messaging_init (CORBA::Octet major,
- CORBA::Octet minor)
+ CORBA::Octet minor)
{
this->messaging_object_->init (major,
- minor);
+ minor);
return 1;
}
@@ -274,12 +354,12 @@ TAO_IIOP_Transport::set_bidir_context_info (TAO_Operation_Details &opdetails)
{
// Check whether it is a IIOP acceptor
if ((*acceptor)->tag () == TAO_TAG_IIOP_PROFILE)
- {
- // @@ Why isn't the return value checked!
- // -Ossama
- this->get_listen_point (listen_point_list,
- *acceptor);
- }
+ {
+ // @@ Why isn't the return value checked!
+ // -Ossama
+ this->get_listen_point (listen_point_list,
+ *acceptor);
+ }
}
// We have the ListenPointList at this point. Create a output CDR
@@ -293,7 +373,7 @@ TAO_IIOP_Transport::set_bidir_context_info (TAO_Operation_Details &opdetails)
// Add this info in to the svc_list
opdetails.request_service_context ().set_context (IOP::BI_DIR_IIOP,
- cdr);
+ cdr);
return;
}
@@ -305,7 +385,7 @@ TAO_IIOP_Transport::get_listen_point (
{
TAO_IIOP_Acceptor *iiop_acceptor =
ACE_dynamic_cast (TAO_IIOP_Acceptor *,
- acceptor );
+ acceptor );
// Get the array of endpoints serviced by TAO_IIOP_Acceptor
const ACE_INET_Addr *endpoint_addr =
@@ -322,10 +402,10 @@ TAO_IIOP_Transport::get_listen_point (
== -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%P|%t) Could not resolve local ")
- ACE_TEXT ("host address in ")
- ACE_TEXT ("get_listen_point()\n")),
- -1);
+ ACE_TEXT ("(%P|%t) Could not resolve local ")
+ ACE_TEXT ("host address in ")
+ ACE_TEXT ("get_listen_point()\n")),
+ -1);
}
// Note: Looks like there is no point in sending the list of
@@ -335,13 +415,13 @@ TAO_IIOP_Transport::get_listen_point (
// Get the hostname for the local address
if (iiop_acceptor->hostname (this->orb_core_,
- local_addr,
- local_interface.out ()) == -1)
+ local_addr,
+ local_interface.out ()) == -1)
{
ACE_ERROR_RETURN ((LM_ERROR,
- ACE_TEXT ("(%P|%t) Could not resolve local host")
- ACE_TEXT (" name \n")),
- -1);
+ ACE_TEXT ("(%P|%t) Could not resolve local host")
+ ACE_TEXT (" name \n")),
+ -1);
}
for (size_t index = 0;
@@ -349,20 +429,20 @@ TAO_IIOP_Transport::get_listen_point (
index++)
{
if (local_addr.get_ip_address()
- == endpoint_addr[index].get_ip_address())
- {
- // Get the count of the number of elements
- CORBA::ULong len = listen_point_list.length ();
-
- // Increase the length by 1
- listen_point_list.length (len + 1);
-
- // We have the connection and the acceptor endpoint on the
- // same interface
- IIOP::ListenPoint &point = listen_point_list[len];
- point.host = CORBA::string_dup (local_interface.in ());
- point.port = endpoint_addr[index].get_port_number ();
- }
+ == endpoint_addr[index].get_ip_address())
+ {
+ // Get the count of the number of elements
+ CORBA::ULong len = listen_point_list.length ();
+
+ // Increase the length by 1
+ listen_point_list.length (len + 1);
+
+ // We have the connection and the acceptor endpoint on the
+ // same interface
+ IIOP::ListenPoint &point = listen_point_list[len];
+ point.host = CORBA::string_dup (local_interface.in ());
+ point.port = endpoint_addr[index].get_port_number ();
+ }
}
return 1;