1 #include "tao/Strategies/UIOP_Transport.h"
5 #include "tao/Strategies/UIOP_Connection_Handler.h"
6 #include "tao/Strategies/UIOP_Profile.h"
7 #include "tao/Timeprobe.h"
9 #include "tao/Transport_Mux_Strategy.h"
10 #include "tao/Wait_Strategy.h"
12 #include "tao/ORB_Core.h"
13 #include "tao/debug.h"
14 #include "tao/GIOP_Message_Base.h"
16 TAO_BEGIN_VERSIONED_NAMESPACE_DECL
18 TAO_UIOP_Transport::TAO_UIOP_Transport (TAO_UIOP_Connection_Handler
*handler
,
19 TAO_ORB_Core
*orb_core
)
20 : TAO_Transport (TAO_TAG_UIOP_PROFILE
,
22 , connection_handler_ (handler
)
26 TAO_UIOP_Transport::~TAO_UIOP_Transport ()
31 TAO_UIOP_Transport::event_handler_i ()
33 return this->connection_handler_
;
36 TAO_Connection_Handler
*
37 TAO_UIOP_Transport::connection_handler_i ()
39 return this->connection_handler_
;
43 TAO_UIOP_Transport::send (iovec
*iov
, int iovcnt
,
44 size_t &bytes_transferred
,
45 const ACE_Time_Value
*max_wait_time
)
47 ssize_t
const retval
=
48 this->connection_handler_
->peer ().sendv (iov
, iovcnt
, max_wait_time
);
51 bytes_transferred
= retval
;
57 TAO_UIOP_Transport::recv (char *buf
,
59 const ACE_Time_Value
*max_wait_time
)
61 const ssize_t n
= this->connection_handler_
->peer ().recv (buf
,
65 // Most of the errors handling is common for
66 // Now the message has been read
68 TAO_debug_level
> 4 &&
71 TAOLIB_DEBUG ((LM_DEBUG
,
72 ACE_TEXT ("TAO (%P|%t) - UIOP_Transport::recv, %p %p\n"),
73 ACE_TEXT ("TAO - read message failure ")
74 ACE_TEXT ("recv ()\n")));
80 if (errno
== EWOULDBLOCK
)
85 // @@ What are the other error handling here??
95 TAO_UIOP_Transport::send_request (TAO_Stub
*stub
,
96 TAO_ORB_Core
*orb_core
,
97 TAO_OutputCDR
&stream
,
98 TAO_Message_Semantics message_semantics
,
99 ACE_Time_Value
*max_wait_time
)
101 if (this->ws_
->sending_request (orb_core
, message_semantics
) == -1)
106 if (this->send_message (stream
, stub
, 0, message_semantics
, max_wait_time
) == -1)
111 this->first_request_sent();
117 TAO_UIOP_Transport::send_message (TAO_OutputCDR
&stream
,
119 TAO_ServerRequest
*request
,
120 TAO_Message_Semantics message_semantics
,
121 ACE_Time_Value
*max_wait_time
)
123 // Format the message in the stream first
124 if (this->messaging_object ()->format_message (stream
, stub
, request
) != 0)
129 // Strictly speaking, should not need to loop here because the
130 // socket never gets set to a nonblocking mode ... some Linux
131 // versions seem to need it though. Leaving it costs little.
133 // This guarantees to send all data (bytes) or return an error.
134 const ssize_t n
= this->send_message_shared (stub
,
142 TAOLIB_DEBUG ((LM_DEBUG
,
143 ACE_TEXT ("TAO (%P|%t) closing transport %d after fault %p\n"),
145 ACE_TEXT ("send_message ()\n")));
153 TAO_END_VERSIONED_NAMESPACE_DECL
155 #endif /* TAO_HAS_UIOP */