diff options
author | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-02-12 23:48:09 +0000 |
---|---|---|
committer | coryan <coryan@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 2001-02-12 23:48:09 +0000 |
commit | 1ac4d0d328a65b28485dd2cc1ce15f01a2411d2a (patch) | |
tree | 1bad13e9bef4ce49dc07d0b0a7ad537af3e47e1f | |
parent | 52a75283d2a03b8ac4be54000614c611685604c7 (diff) | |
download | ATCD-1ac4d0d328a65b28485dd2cc1ce15f01a2411d2a.tar.gz |
ChangeLogTag:Mon Feb 12 15:44:54 2001 Carlos O'Ryan <coryan@uci.edu>
-rw-r--r-- | TAO/ChangeLogs/ChangeLog-02a | 23 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp | 74 | ||||
-rw-r--r-- | TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h | 6 | ||||
-rw-r--r-- | TAO/tao/GIOP_Message_Lite.cpp | 4 | ||||
-rw-r--r-- | TAO/tao/Makefile | 9 | ||||
-rw-r--r-- | TAO/tao/Strategies/SHMIOP_Transport.cpp | 21 | ||||
-rw-r--r-- | TAO/tao/Strategies/SHMIOP_Transport.h | 6 | ||||
-rw-r--r-- | TAO/tao/Strategies/UIOP_Transport.cpp | 16 | ||||
-rw-r--r-- | TAO/tao/Strategies/UIOP_Transport.h | 6 | ||||
-rw-r--r-- | TAO/tao/Sync_Strategies.cpp | 7 | ||||
-rw-r--r-- | TAO/tao/Sync_Strategies.h | 12 | ||||
-rw-r--r-- | TAO/tao/Transport.cpp | 11 |
12 files changed, 89 insertions, 106 deletions
diff --git a/TAO/ChangeLogs/ChangeLog-02a b/TAO/ChangeLogs/ChangeLog-02a index a6d4ffad94d..6bc38dc0da6 100644 --- a/TAO/ChangeLogs/ChangeLog-02a +++ b/TAO/ChangeLogs/ChangeLog-02a @@ -1,3 +1,26 @@ +Mon Feb 12 15:44:54 2001 Carlos O'Ryan <coryan@uci.edu> + + * tao/Makefile: + Update makefile to include new files + + * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h: + * orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp: + * tao/Strategies/SHMIOP_Transport.h: + * tao/Strategies/SHMIOP_Transport.cpp: + * tao/Strategies/UIOP_Transport.h: + * tao/Strategies/UIOP_Transport.cpp: + Fixed all protocols to use the new send() method with iovec + parameters. + + * tao/GIOP_Message_Lite.cpp: + Use the send() method with iovec arguments. + + * tao/Sync_Strategies.h: + * tao/Sync_Strategies.cpp: + * tao/Transport.cpp: + More cleanup for the Sync_Strategies, the must_queue() method + does not require a Stub argument. + Mon Feb 12 10:15:47 2001 Carlos O'Ryan <coryan@uci.edu> * tao/Transport.h: diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp index dc24319d98b..ce86988506b 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.cpp @@ -75,74 +75,16 @@ TAO_SSLIOP_Transport::idle (void) } ssize_t -TAO_SSLIOP_Transport::send (const ACE_Message_Block *message_block, - const ACE_Time_Value *max_wait_time, - size_t *bt) +TAO_SSLIOP_Transport::send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *timeout = 0) { - // @@ This code should be refactored into ACE.cpp or something - // similar! + ssize_t retval = this->service_handler ()->peer ().sendv (iov, iovcnt, + max_wait_time); + if (retval > 0) + bytes_transferred = retval; - // For the most part this was copied from GIOP::send_request and - // friends. - - size_t temp; - size_t &bytes_transferred = bt == 0 ? temp : *bt; - - 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; - } - } - } - - // 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; - - bytes_transferred += n; - } - - return bytes_transferred; + return retval; } ssize_t diff --git a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h index 84b3c86cfaa..75ce458eaf1 100644 --- a/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h +++ b/TAO/orbsvcs/orbsvcs/SSLIOP/SSLIOP_Transport.h @@ -76,9 +76,9 @@ public: virtual int idle (void); /// Write the complete Message_Block chain to the connection. - virtual ssize_t send (const ACE_Message_Block *mblk, - const ACE_Time_Value *s = 0, - size_t *bytes_transferred = 0); + virtual ssize_t send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *timeout = 0); /// Read len bytes from into buf. virtual ssize_t recv (char *buf, diff --git a/TAO/tao/GIOP_Message_Lite.cpp b/TAO/tao/GIOP_Message_Lite.cpp index 00596e71347..9947469b4fb 100644 --- a/TAO/tao/GIOP_Message_Lite.cpp +++ b/TAO/tao/GIOP_Message_Lite.cpp @@ -1350,7 +1350,9 @@ TAO_GIOP_Message_Lite::send_error (TAO_Transport *transport) ACE_Message_Block message_block(&data_block); message_block.wr_ptr (TAO_GIOP_LITE_HEADER_LEN); - int result = transport->send (&message_block); + size_t bytes_transferred; + int result = transport->send_message_block_chain (&message_block, + bytes_transferred); if (result == -1) { if (TAO_debug_level > 0) diff --git a/TAO/tao/Makefile b/TAO/tao/Makefile index 6e0193285b7..f716337e2c6 100644 --- a/TAO/tao/Makefile +++ b/TAO/tao/Makefile @@ -26,6 +26,11 @@ PUB_HDRS = \ Pluggable \ Transport \ MProfile \ + Flushing_Strategy \ + Block_Flushing_Strategy \ + Reactive_Flushing_Strategy \ + Queued_Message \ + Message_Sent_Callback \ IIOP_Factory \ IIOP_Profile \ IIOP_Transport \ @@ -86,6 +91,10 @@ PLUGGABLE_PROTOCOLS_FILES = \ Acceptor_Registry \ Protocol_Factory \ Acceptor_Filter \ + Flushing_Strategy \ + Block_Flushing_Strategy \ + Reactive_Flushing_Strategy \ + Queued_Message \ iiop_endpoints \ IIOP_Factory \ IIOP_Lite_Factory \ diff --git a/TAO/tao/Strategies/SHMIOP_Transport.cpp b/TAO/tao/Strategies/SHMIOP_Transport.cpp index 3931ecfc0b7..a3bb82d6616 100644 --- a/TAO/tao/Strategies/SHMIOP_Transport.cpp +++ b/TAO/tao/Strategies/SHMIOP_Transport.cpp @@ -90,12 +90,23 @@ TAO_SHMIOP_Transport::idle (void) } ssize_t -TAO_SHMIOP_Transport::send (const ACE_Message_Block *message_block, - const ACE_Time_Value *max_wait_time, - size_t *) +TAO_SHMIOP_Transport::send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *max_wait_time) { - return this->service_handler ()->peer ().send (message_block, - max_wait_time); + bytes_transferred = 0; + for (int i = 0; i < iovcnt; ++i) + { + ssize_t retval = + this->service_handler ()->peer ().send (iov[i].iov_base, + iov[i].iov_len, + max_wait_time); + if (retval > 0) + bytes_transferred += retval; + if (retval <= 0) + return retval; + } + return bytes_transferred; } ssize_t diff --git a/TAO/tao/Strategies/SHMIOP_Transport.h b/TAO/tao/Strategies/SHMIOP_Transport.h index 6f7417b1ec5..465575ac5c4 100644 --- a/TAO/tao/Strategies/SHMIOP_Transport.h +++ b/TAO/tao/Strategies/SHMIOP_Transport.h @@ -69,9 +69,9 @@ public: virtual int idle (void); /// Write the complete Message_Block chain to the connection. - virtual ssize_t send (const ACE_Message_Block *mblk, - const ACE_Time_Value *s = 0, - size_t *bytes_transferred = 0); + virtual ssize_t send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *timeout = 0); /// Read len bytes from into buf. virtual ssize_t recv (char *buf, diff --git a/TAO/tao/Strategies/UIOP_Transport.cpp b/TAO/tao/Strategies/UIOP_Transport.cpp index 54ad2408b58..b7d9fe95734 100644 --- a/TAO/tao/Strategies/UIOP_Transport.cpp +++ b/TAO/tao/Strategies/UIOP_Transport.cpp @@ -91,14 +91,16 @@ TAO_UIOP_Transport::idle (void) } ssize_t -TAO_UIOP_Transport::send (const ACE_Message_Block *message_block, - const ACE_Time_Value *max_wait_time, - size_t *bytes_transferred) +TAO_UIOP_Transport::send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *max_wait_time) { - return ACE::send_n (this->handle (), - message_block, - max_wait_time, - bytes_transferred); + ssize_t retval = this->service_handler ()->peer ().sendv (iov, iovcnt, + max_wait_time); + if (retval > 0) + bytes_transferred = retval; + + return retval; } ssize_t diff --git a/TAO/tao/Strategies/UIOP_Transport.h b/TAO/tao/Strategies/UIOP_Transport.h index 913ae5d527f..c816bfe681d 100644 --- a/TAO/tao/Strategies/UIOP_Transport.h +++ b/TAO/tao/Strategies/UIOP_Transport.h @@ -74,9 +74,9 @@ public: virtual int idle (void); /// Write the complete Message_Block chain to the connection. - virtual ssize_t send (const ACE_Message_Block *mblk, - const ACE_Time_Value *s = 0, - size_t *bytes_transferred = 0); + virtual ssize_t send (iovec *iov, int iovcnt, + size_t &bytes_transferred, + const ACE_Time_Value *timeout = 0); /// Read len bytes from into buf. virtual ssize_t recv (char *buf, diff --git a/TAO/tao/Sync_Strategies.cpp b/TAO/tao/Sync_Strategies.cpp index d79f1109e27..36c923f1ee0 100644 --- a/TAO/tao/Sync_Strategies.cpp +++ b/TAO/tao/Sync_Strategies.cpp @@ -18,7 +18,7 @@ TAO_Sync_Strategy::~TAO_Sync_Strategy (void) int TAO_Transport_Sync_Strategy:: - must_queue (TAO_Stub *, int) + must_queue (int) { return 0; } @@ -40,7 +40,7 @@ TAO_Transport_Sync_Strategy:: int TAO_Eager_Buffering_Sync_Strategy:: - must_queue (TAO_Stub *, int) + must_queue (int) { return 1; } @@ -123,8 +123,7 @@ TAO_Eager_Buffering_Sync_Strategy:: int TAO_Delayed_Buffering_Sync_Strategy:: - must_queue (TAO_Stub *, - int queue_empty) + must_queue (int queue_empty) { // If the queue is empty we want to send immediately return !queue_empty; diff --git a/TAO/tao/Sync_Strategies.h b/TAO/tao/Sync_Strategies.h index 231d81a9624..b5f2ae4b2ee 100644 --- a/TAO/tao/Sync_Strategies.h +++ b/TAO/tao/Sync_Strategies.h @@ -48,8 +48,7 @@ public: virtual ~TAO_Sync_Strategy (void); /// Return 1 if a message must be queued - virtual int must_queue (TAO_Stub *stub, - int queue_empty) = 0; + virtual int must_queue (int queue_empty) = 0; /// Return 1 if it is time to start /** @@ -72,8 +71,7 @@ public: class TAO_Export TAO_Transport_Sync_Strategy : public TAO_Sync_Strategy { public: - virtual int must_queue (TAO_Stub *stub, - int queue_empty); + virtual int must_queue (int queue_empty); virtual int buffering_constraints_reached (TAO_Stub *stub, size_t msg_count, @@ -87,8 +85,7 @@ public: class TAO_Export TAO_Eager_Buffering_Sync_Strategy : public TAO_Sync_Strategy { public: - virtual int must_queue (TAO_Stub *stub, - int queue_empty); + virtual int must_queue (int queue_empty); virtual int buffering_constraints_reached (TAO_Stub *stub, size_t msg_count, @@ -120,8 +117,7 @@ private: class TAO_Export TAO_Delayed_Buffering_Sync_Strategy : public TAO_Eager_Buffering_Sync_Strategy { public: - virtual int must_queue (TAO_Stub *stub, - int queue_empty); + virtual int must_queue (int queue_empty); }; #endif /* TAO_HAS_BUFFERING_CONSTRAINT_POLICY == 1 */ diff --git a/TAO/tao/Transport.cpp b/TAO/tao/Transport.cpp index d3ca90cee6f..a9fc19e0d3d 100644 --- a/TAO/tao/Transport.cpp +++ b/TAO/tao/Transport.cpp @@ -154,7 +154,7 @@ TAO_Transport::send_message_block_chain (const ACE_Message_Block *message_block, // Select the next message block in the chain. message_block = message_block->cont (); } - + // Check for remaining buffers to be sent. This will happen when // IOV_MAX is not a multiple of the number of message blocks. if (iovcnt != 0) @@ -265,8 +265,7 @@ TAO_Transport::send_message_i (TAO_Stub *stub, int non_queued_message = (this->current_message_ == 0) // There is an outgoing message already && (twoway_flag - || !stub->sync_strategy ().must_queue (stub, - queue_empty)); + || !stub->sync_strategy ().must_queue (queue_empty)); TAO_Queued_Message *queued_message = 0; if (non_queued_message) @@ -281,7 +280,7 @@ TAO_Transport::send_message_i (TAO_Stub *stub, // code I will re-visit this stuff. ssize_t n = this->send_message_block_chain (message_block, byte_count, - 0 /* non-blocking */); + max_wait_time); if (n == 0) return -1; else if (n == -1 && errno != EWOULDBLOCK) @@ -293,8 +292,8 @@ TAO_Transport::send_message_i (TAO_Stub *stub, // Done, just return. Notice that there are no allocations // or copies up to this point (though some fancy calling // back and forth). - // This should be the normal path in the ORB, it should be - // fast. + // This is the common case for the critical path, it should + // be fast. return 0; } |