diff options
author | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-12-07 03:35:51 +0000 |
---|---|---|
committer | irfan <irfan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-12-07 03:35:51 +0000 |
commit | 7a1899e8f3a05d76f840805a4a68efaf93cde4bd (patch) | |
tree | 822082ba0117438680286ce346b1d419758935a6 /TAO/tao/IIOP_Transport.cpp | |
parent | 31bc16e53f375e543cb94a665beedda7958ee170 (diff) | |
download | ATCD-7a1899e8f3a05d76f840805a4a68efaf93cde4bd.tar.gz |
ChangeLogTag: Mon Dec 06 21:16:53 1999 Irfan Pyarali <irfan@cs.wustl.edu>
Diffstat (limited to 'TAO/tao/IIOP_Transport.cpp')
-rw-r--r-- | TAO/tao/IIOP_Transport.cpp | 89 |
1 files changed, 19 insertions, 70 deletions
diff --git a/TAO/tao/IIOP_Transport.cpp b/TAO/tao/IIOP_Transport.cpp index 9471db6b05d..6727a930585 100644 --- a/TAO/tao/IIOP_Transport.cpp +++ b/TAO/tao/IIOP_Transport.cpp @@ -56,7 +56,12 @@ TAO_IIOP_Transport::TAO_IIOP_Transport (TAO_IIOP_Handler_Base *handler, TAO_IIOP_Transport::~TAO_IIOP_Transport (void) { - this->flush_buffered_messages (); + // Cannot deal with errors, and therefore they are ignored. + this->send_buffered_messages (); + + // Note that it also doesn't matter how much of the data was + // actually sent. + this->dequeue_all (); } TAO_IIOP_Handler_Base *& @@ -307,7 +312,7 @@ TAO_IIOP_Client_Transport::register_handler (void) ssize_t TAO_IIOP_Transport::send (TAO_Stub *stub, const ACE_Message_Block *message_block, - ACE_Time_Value *max_wait_time) + const ACE_Time_Value *max_wait_time) { if (stub == 0) { @@ -327,93 +332,37 @@ TAO_IIOP_Transport::send (TAO_Stub *stub, ssize_t TAO_IIOP_Transport::send (const ACE_Message_Block *message_block, - ACE_Time_Value *max_wait_time) + const ACE_Time_Value *max_wait_time) { TAO_FUNCTION_PP_TIMEPROBE (TAO_IIOP_TRANSPORT_SEND_START); - // @@ This code should be refactored into ACE.cpp or something - // similar! - - // For the most part this was copied from GIOP::send_request and - // friends. - - iovec iov[IOV_MAX]; - int iovcnt = 0; - ssize_t n = 0; - ssize_t nbytes = 0; - - for (const ACE_Message_Block *i = message_block; - i != 0; - i = i->cont ()) - { - // Make sure there is something to send! - if (i->length () > 0) - { - iov[iovcnt].iov_base = i->rd_ptr (); - iov[iovcnt].iov_len = i->length (); - iovcnt++; - - // The buffer is full make a OS call. @@ TODO this should - // be optimized on a per-platform basis, for instance, some - // platforms do not implement writev() there we should copy - // the data into a buffer and call send_n(). In other cases - // there may be some limits on the size of the iovec, there - // we should set IOV_MAX to that limit. - if (iovcnt == IOV_MAX) - { - if (max_wait_time == 0) - n = this->handler_->peer ().sendv_n (iov, - iovcnt); - else - n = ACE::writev (this->handler_->peer ().get_handle (), - iov, - iovcnt, - max_wait_time); - - if (n <= 0) - return n; - - nbytes += n; - iovcnt = 0; - } - } - } - - // Check for remaining buffers to be sent! - if (iovcnt != 0) - { - n = this->handler_->peer ().sendv_n (iov, - iovcnt); - if (n < 1) - return n; - - nbytes += n; - } - - return nbytes; + return ACE::send_n (this->handle (), + message_block, + max_wait_time); } ssize_t TAO_IIOP_Transport::send (const u_char *buf, size_t len, - ACE_Time_Value *) + const ACE_Time_Value *max_wait_time) { TAO_FUNCTION_PP_TIMEPROBE (TAO_IIOP_TRANSPORT_SEND_START); - return this->handler_->peer ().send_n (buf, len); + return this->handler_->peer ().send_n (buf, + len, + max_wait_time); } ssize_t TAO_IIOP_Transport::recv (char *buf, size_t len, - ACE_Time_Value *max_wait_time) + const ACE_Time_Value *max_wait_time) { TAO_FUNCTION_PP_TIMEPROBE (TAO_IIOP_TRANSPORT_RECEIVE_START); - return ACE::recv_n (this->handler_->peer ().get_handle (), - buf, - len, - max_wait_time); + return this->handler_->peer ().recv_n (buf, + len, + max_wait_time); } // Default action to be taken for send request. |