diff options
Diffstat (limited to 'TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp')
-rw-r--r-- | TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp | 115 |
1 files changed, 27 insertions, 88 deletions
diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp index 5fad414b4a6..04d796e16c9 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp @@ -60,75 +60,33 @@ TAO_SSLIOP_Transport::event_handler (void) return this->connection_handler_; } -ssize_t -TAO_SSLIOP_Transport::send (const ACE_Message_Block *message_block, - const ACE_Time_Value *max_wait_time, - size_t *bt) +void +TAO_SSLIOP_Transport::close_connection (void) { - // @@ This code should be refactored into ACE.cpp or something - // similar! - - // For the most part this was copied from GIOP::send_request and - // friends. - - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; + // First close the handle + this->connection_handler_->handle_close (); - iovec iov[IOV_MAX]; - int iovcnt = 0; - ssize_t n = 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->service_handler ()->peer ().sendv_n (iov, - iovcnt); - else - // @@ No timeouts!!! - n = this->service_handler ()->peer ().sendv_n (iov, - iovcnt /*, - max_wait_time */); - - if (n == 0 || - n == -1) - return n; - - bytes_transferred += n; - iovcnt = 0; - } - } - } + // Purge the entry + this->connection_handler_->purge_entry (); +} - // Check for remaining buffers to be sent! - if (iovcnt != 0) - { - n = this->service_handler ()->peer ().sendv_n (iov, - iovcnt); - if (n == 0 || - n == -1) - return n; +int +TAO_SSLIOP_Transport::idle (void) +{ + return this->connection_handler_->make_idle (); +} - bytes_transferred += n; - } +ssize_t +TAO_SSLIOP_Transport::send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *max_wait_time) +{ + ssize_t retval = this->service_handler ()->peer ().send (iov, iovcnt, + max_wait_time); + if (retval > 0) + bytes_transferred = retval; - return bytes_transferred; + return retval; } ssize_t @@ -187,6 +145,10 @@ TAO_SSLIOP_Transport::register_handler (void) if (r == this->connection_handler_->reactor ()) return 0; + // About to be registered with the reactor, so bump the ref + // count + this->connection_handler_->incr_ref_count (); + // Set the flag in the Connection Handler this->connection_handler_->is_registered (1); @@ -233,7 +195,7 @@ TAO_SSLIOP_Transport::send_message (TAO_OutputCDR &stream, // versions seem to need it though. Leaving it costs little. // This guarantees to send all data (bytes) or return an error. - ssize_t n = this->send_or_buffer (stub, + ssize_t n = this->send_message_i (stub, twoway, stream.begin (), max_wait_time); @@ -249,17 +211,6 @@ TAO_SSLIOP_Transport::send_message (TAO_OutputCDR &stream, return -1; } - // EOF. - if (n == 0) - { - if (TAO_debug_level) - ACE_DEBUG ((LM_DEBUG, - ACE_TEXT ("TAO: (%P|%t|%N|%l) send_message () \n") - ACE_TEXT ("EOF, closing conn %d\n"), - this->handle())); - return -1; - } - return 1; } @@ -597,15 +548,3 @@ TAO_SSLIOP_Transport::get_listen_point ( return 1; } - -void -TAO_SSLIOP_Transport::transition_handler_state (void) -{ - connection_handler_ = 0; -} - -TAO_Connection_Handler* -TAO_SSLIOP_Transport::connection_handler (void) const -{ - return connection_handler_; -} |