diff options
author | schmidt <douglascraigschmidt@users.noreply.github.com> | 2001-08-08 14:24:31 +0000 |
---|---|---|
committer | schmidt <douglascraigschmidt@users.noreply.github.com> | 2001-08-08 14:24:31 +0000 |
commit | bf799f935b21885f8491db15dda0f49c6b8818c7 (patch) | |
tree | 209213071136768c4dbf03b15555104b4b3d9a22 | |
parent | ae71a6261d23205d926b46d7ec62e3bbc8369555 (diff) | |
download | ATCD-bf799f935b21885f8491db15dda0f49c6b8818c7.tar.gz |
ChangeLogTag:Wed Aug 8 06:21:24 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
-rw-r--r-- | ChangeLog | 43 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-02a | 43 | ||||
-rw-r--r-- | ChangeLogs/ChangeLog-03a | 43 | ||||
-rw-r--r-- | THANKS | 1 | ||||
-rw-r--r-- | ace/ACE.cpp | 20 | ||||
-rw-r--r-- | ace/ACE.h | 3 | ||||
-rw-r--r-- | ace/Asynch_IO.h | 4 | ||||
-rw-r--r-- | ace/Asynch_IO_Impl.h | 4 | ||||
-rw-r--r-- | ace/CDR_Stream.i | 4 | ||||
-rw-r--r-- | ace/FILE_IO.h | 10 | ||||
-rw-r--r-- | ace/FILE_IO.i | 12 | ||||
-rw-r--r-- | ace/Makefile | 2 | ||||
-rw-r--r-- | ace/OS.h | 2 | ||||
-rw-r--r-- | ace/OS_Dirent.inl | 2 | ||||
-rw-r--r-- | ace/SOCK_Stream.h | 20 | ||||
-rw-r--r-- | ace/SOCK_Stream.i | 12 | ||||
-rw-r--r-- | ace/Svc_Handler.cpp | 64 | ||||
-rw-r--r-- | ace/Svc_Handler.h | 4 | ||||
-rw-r--r-- | ace/WIN32_Asynch_IO.cpp | 8 | ||||
-rw-r--r-- | ace/WIN32_Asynch_IO.h | 4 | ||||
-rw-r--r-- | ace/config-win32-common.h | 10 | ||||
-rw-r--r-- | tests/Svc_Handler_Test.cpp | 43 |
22 files changed, 243 insertions, 115 deletions
diff --git a/ChangeLog b/ChangeLog index b3dc61a103d..a6c62e447d9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,42 @@ +Wed Aug 8 06:21:24 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu> + + * ace/Makefile: Moved Message_Block from STREAMS_FILES to + UTILS_FILES. + + * ace/OS_Dirent.inl (closedir): Changed delete d->directory_name_ to + delete [] d->directory_name_. Thanks to Olivier Brunet + <obrunet@groupama-ccama.tm.fr> for reporting this. + +Tue Aug 7 21:59:42 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu> + + * tests/Svc_Handler_Test.cpp: Modified the test to dump the contents + of the temporary file to the log file. + +Tue Aug 7 19:14:24 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu> + + * ace/CDR_Stream.i: + * ace/SOCK_Stream.h: Fixed incorrect comments. + Thanks to Alain Decamps <Alain.Decamps@PIDPA.be> for reporting + these. + +Tue Aug 7 15:19:38 2001 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> + + * ace: Changed all uses of IOV_MAX to use the new ACE_IOV_MAX. + + * ace/OS.h: Added a new ACE_IOV_MAX that makes it clear this is + an ACE-level #define. We use this in C++NP v1. + +Tue Aug 7 14:16:57 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu> + + * ace/Svc_Handler.cpp: Reimplemented the flush() method to use + the new send_n() method on the various ACE I/O classes. + + * ace/SOCK_Stream.{h,i}: + * ace/FILE_IO.{h,i}: Added a new send_n() method that sends all + the <message_block>s chained through their <next> and <cont> + pointers using the underlying OS gather-write operation to + reduce the domain-crossing penalty. + Tue Aug 7 17:27:16 2001 Balachandran Natarajan <bala@cs.wustl.edu> * tests/Collection_test.cpp: Fixed a compile error with g++. This @@ -27,8 +66,8 @@ Tue Aug 07 16:40:12 2001 Johnny Willemsen <jwillemsen@remedy.nl> check that the iterator instance is assigned to itself * tests/Hash_Map_Manager_Test.cpp - Extended this test to test the new const_iterator capabilities of - the hash map + Extended this test to test the new const_iterator capabilities + of the hash map * ace/Unbounded_Set.cpp: Implemented missing operator* for the const iterator diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a index b3dc61a103d..a6c62e447d9 100644 --- a/ChangeLogs/ChangeLog-02a +++ b/ChangeLogs/ChangeLog-02a @@ -1,3 +1,42 @@ +Wed Aug 8 06:21:24 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu> + + * ace/Makefile: Moved Message_Block from STREAMS_FILES to + UTILS_FILES. + + * ace/OS_Dirent.inl (closedir): Changed delete d->directory_name_ to + delete [] d->directory_name_. Thanks to Olivier Brunet + <obrunet@groupama-ccama.tm.fr> for reporting this. + +Tue Aug 7 21:59:42 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu> + + * tests/Svc_Handler_Test.cpp: Modified the test to dump the contents + of the temporary file to the log file. + +Tue Aug 7 19:14:24 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu> + + * ace/CDR_Stream.i: + * ace/SOCK_Stream.h: Fixed incorrect comments. + Thanks to Alain Decamps <Alain.Decamps@PIDPA.be> for reporting + these. + +Tue Aug 7 15:19:38 2001 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> + + * ace: Changed all uses of IOV_MAX to use the new ACE_IOV_MAX. + + * ace/OS.h: Added a new ACE_IOV_MAX that makes it clear this is + an ACE-level #define. We use this in C++NP v1. + +Tue Aug 7 14:16:57 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu> + + * ace/Svc_Handler.cpp: Reimplemented the flush() method to use + the new send_n() method on the various ACE I/O classes. + + * ace/SOCK_Stream.{h,i}: + * ace/FILE_IO.{h,i}: Added a new send_n() method that sends all + the <message_block>s chained through their <next> and <cont> + pointers using the underlying OS gather-write operation to + reduce the domain-crossing penalty. + Tue Aug 7 17:27:16 2001 Balachandran Natarajan <bala@cs.wustl.edu> * tests/Collection_test.cpp: Fixed a compile error with g++. This @@ -27,8 +66,8 @@ Tue Aug 07 16:40:12 2001 Johnny Willemsen <jwillemsen@remedy.nl> check that the iterator instance is assigned to itself * tests/Hash_Map_Manager_Test.cpp - Extended this test to test the new const_iterator capabilities of - the hash map + Extended this test to test the new const_iterator capabilities + of the hash map * ace/Unbounded_Set.cpp: Implemented missing operator* for the const iterator diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a index b3dc61a103d..a6c62e447d9 100644 --- a/ChangeLogs/ChangeLog-03a +++ b/ChangeLogs/ChangeLog-03a @@ -1,3 +1,42 @@ +Wed Aug 8 06:21:24 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu> + + * ace/Makefile: Moved Message_Block from STREAMS_FILES to + UTILS_FILES. + + * ace/OS_Dirent.inl (closedir): Changed delete d->directory_name_ to + delete [] d->directory_name_. Thanks to Olivier Brunet + <obrunet@groupama-ccama.tm.fr> for reporting this. + +Tue Aug 7 21:59:42 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu> + + * tests/Svc_Handler_Test.cpp: Modified the test to dump the contents + of the temporary file to the log file. + +Tue Aug 7 19:14:24 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu> + + * ace/CDR_Stream.i: + * ace/SOCK_Stream.h: Fixed incorrect comments. + Thanks to Alain Decamps <Alain.Decamps@PIDPA.be> for reporting + these. + +Tue Aug 7 15:19:38 2001 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu> + + * ace: Changed all uses of IOV_MAX to use the new ACE_IOV_MAX. + + * ace/OS.h: Added a new ACE_IOV_MAX that makes it clear this is + an ACE-level #define. We use this in C++NP v1. + +Tue Aug 7 14:16:57 2001 Douglas C. Schmidt <schmidt@tango.doc.wustl.edu> + + * ace/Svc_Handler.cpp: Reimplemented the flush() method to use + the new send_n() method on the various ACE I/O classes. + + * ace/SOCK_Stream.{h,i}: + * ace/FILE_IO.{h,i}: Added a new send_n() method that sends all + the <message_block>s chained through their <next> and <cont> + pointers using the underlying OS gather-write operation to + reduce the domain-crossing penalty. + Tue Aug 7 17:27:16 2001 Balachandran Natarajan <bala@cs.wustl.edu> * tests/Collection_test.cpp: Fixed a compile error with g++. This @@ -27,8 +66,8 @@ Tue Aug 07 16:40:12 2001 Johnny Willemsen <jwillemsen@remedy.nl> check that the iterator instance is assigned to itself * tests/Hash_Map_Manager_Test.cpp - Extended this test to test the new const_iterator capabilities of - the hash map + Extended this test to test the new const_iterator capabilities + of the hash map * ace/Unbounded_Set.cpp: Implemented missing operator* for the const iterator @@ -1307,6 +1307,7 @@ Patrick Rabau <Patrick.Rabau@htc.com> Hyman Rosen <hyrosen@mail.com> Torbjorn Backstrom <torbjorn.k.backstrom@volvo.com> Robert Burke <rburke2002@yahoo.com> +Olivier Brunet <obrunet@groupama-ccama.tm.fr> I would particularly like to thank Paul Stephenson, who worked with me at Ericsson in the early 1990's. Paul devised the recursive Makefile diff --git a/ace/ACE.cpp b/ace/ACE.cpp index f026ba8ec28..0e351575fcc 100644 --- a/ace/ACE.cpp +++ b/ace/ACE.cpp @@ -1273,7 +1273,7 @@ ACE::recv_n (ACE_HANDLE handle, size_t &bytes_transferred = bt == 0 ? temp : *bt; bytes_transferred = 0; - iovec iov[IOV_MAX]; + iovec iov[ACE_IOV_MAX]; int iovcnt = 0; while (message_block != 0) @@ -1297,10 +1297,10 @@ ACE::recv_n (ACE_HANDLE handle, iovcnt++; // The buffer is full make a OS call. @@ TODO find a way to - // find IOV_MAX for platforms that do not define it rather - // than simply setting IOV_MAX to some arbitrary value such + // find ACE_IOV_MAX for platforms that do not define it rather + // than simply setting ACE_IOV_MAX to some arbitrary value such // as 16. - if (iovcnt == IOV_MAX) + if (iovcnt == ACE_IOV_MAX) { size_t current_transfer = 0; @@ -1331,7 +1331,7 @@ ACE::recv_n (ACE_HANDLE handle, } // Check for remaining buffers to be sent. This will happen when - // IOV_MAX is not a multiple of the number of message blocks. + // ACE_IOV_MAX is not a multiple of the number of message blocks. if (iovcnt != 0) { size_t current_transfer = 0; @@ -2077,7 +2077,7 @@ ACE::send_n (ACE_HANDLE handle, size_t &bytes_transferred = bt == 0 ? temp : *bt; bytes_transferred = 0; - iovec iov[IOV_MAX]; + iovec iov[ACE_IOV_MAX]; int iovcnt = 0; while (message_block != 0) @@ -2101,10 +2101,10 @@ ACE::send_n (ACE_HANDLE handle, iovcnt++; // The buffer is full make a OS call. @@ TODO find a way to - // find IOV_MAX for platforms that do not define it rather - // than simply setting IOV_MAX to some arbitrary value such + // find ACE_IOV_MAX for platforms that do not define it rather + // than simply setting ACE_IOV_MAX to some arbitrary value such // as 16. - if (iovcnt == IOV_MAX) + if (iovcnt == ACE_IOV_MAX) { size_t current_transfer = 0; @@ -2135,7 +2135,7 @@ ACE::send_n (ACE_HANDLE handle, } // Check for remaining buffers to be sent. This will happen when - // IOV_MAX is not a multiple of the number of message blocks. + // ACE_IOV_MAX is not a multiple of the number of message blocks. if (iovcnt != 0) { size_t current_transfer = 0; diff --git a/ace/ACE.h b/ace/ACE.h index 7f348596986..2f348b87ded 100644 --- a/ace/ACE.h +++ b/ace/ACE.h @@ -276,6 +276,9 @@ public: const ACE_Time_Value *timeout = 0, size_t *bytes_transferred = 0); + /// Send all the <message_block>s chained through their <next> and + /// <cont> pointers. This call uses the underlying OS gather-write + /// operationto reduce the domain-crossing penalty. static ssize_t send_n (ACE_HANDLE handle, const ACE_Message_Block *message_block, const ACE_Time_Value *timeout = 0, diff --git a/ace/Asynch_IO.h b/ace/Asynch_IO.h index d7fb6de39d1..311650d33ee 100644 --- a/ace/Asynch_IO.h +++ b/ace/Asynch_IO.h @@ -1077,7 +1077,7 @@ public: * errno to get the error code. * * Scatter/gather is supported on WIN32 by using the <message_block->cont()> - * method. Up to IOV_MAX <message_block>'s are supported. Upto + * method. Up to ACE_IOV_MAX <message_block>'s are supported. Upto * <message_block->size()> bytes will be read into each <message block> for * a total of <message_block->total_size()> bytes. All <message_block>'s * <wr_ptr>'s will be updated to reflect the added bytes for each @@ -1212,7 +1212,7 @@ public: * errno to get the error code. * * Scatter/gather is supported on WIN32 by using the <message_block->cont()> - * method. Up to IOV_MAX <message_block>'s are supported. Upto + * method. Up to ACE_IOV_MAX <message_block>'s are supported. Upto * <message_block->length()> bytes will be sent from each <message block> * for a total of <message_block->total_length()> bytes. All * <message_block>'s <rd_ptr>'s will be updated to reflect the bytes sent diff --git a/ace/Asynch_IO_Impl.h b/ace/Asynch_IO_Impl.h index b2b8820806a..5137145534d 100644 --- a/ace/Asynch_IO_Impl.h +++ b/ace/Asynch_IO_Impl.h @@ -530,7 +530,7 @@ public: * errno to get the error code. * * Scatter/gather is supported on WIN32 by using the <message_block->cont()> - * method. Up to IOV_MAX <message_block>'s are supported. Upto + * method. Up to ACE_IOV_MAX <message_block>'s are supported. Upto * <message_block->size()> bytes will be read into each <message block> for * a total of <message_block->total_size()> bytes. All <message_block>'s * <wr_ptr>'s will be updated to reflect the added bytes for each @@ -616,7 +616,7 @@ public: * errno to get the error code. * * Scatter/gather is supported on WIN32 by using the <message_block->cont()> - * method. Up to IOV_MAX <message_block>'s are supported. Upto + * method. Up to ACE_IOV_MAX <message_block>'s are supported. Upto * <message_block->length()> bytes will be sent from each <message block> * for a total of <message_block->total_length()> bytes. All * <message_block>'s <rd_ptr>'s will be updated to reflect the bytes sent diff --git a/ace/CDR_Stream.i b/ace/CDR_Stream.i index 80bf3ce7fd7..400c1b9d3e9 100644 --- a/ace/CDR_Stream.i +++ b/ace/CDR_Stream.i @@ -164,12 +164,12 @@ ACE_OutputCDR::reset (void) } -// Decode the CDR stream. +// Encode the CDR stream. ACE_INLINE ACE_CDR::Boolean ACE_OutputCDR::write_octet (ACE_CDR::Octet x) { - return this->write_1 (ACE_reinterpret_cast (const ACE_CDR::Octet*,&x)); + return this->write_1 (ACE_reinterpret_cast (const ACE_CDR::Octet *, &x)); } ACE_INLINE ACE_CDR::Boolean diff --git a/ace/FILE_IO.h b/ace/FILE_IO.h index 512ace0fdba..817da5d1e68 100644 --- a/ace/FILE_IO.h +++ b/ace/FILE_IO.h @@ -25,6 +25,9 @@ // Used in the FILE_IO.h file... #include "ace/ACE.h" +// Forward decl. +class ACE_Message_Block; + /** * @class ACE_FILE_IO * @@ -48,6 +51,13 @@ public: /// Send n bytes, keep trying until n are sent. ssize_t send_n (const void *buf, size_t n) const; + /// Send all the <message_block>s chained through their <next> and + /// <cont> pointers. This call uses the underlying OS gather-write + /// operationto reduce the domain-crossing penalty. + ssize_t send_n (const ACE_Message_Block *message_block, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0); + /// Recv n bytes, keep trying until n are received. ssize_t recv_n (void *buf, size_t n) const; diff --git a/ace/FILE_IO.i b/ace/FILE_IO.i index ab5956c468c..d5739e6406e 100644 --- a/ace/FILE_IO.i +++ b/ace/FILE_IO.i @@ -12,6 +12,18 @@ ACE_FILE_IO::sendv_n (const iovec iov[], size_t n) const n); } +ASYS_INLINE ssize_t +ACE_FILE_IO::send_n (const ACE_Message_Block *message_block, + const ACE_Time_Value *timeout, + size_t *bytes_transferred) +{ + ACE_TRACE ("ACE_FILE_IO::send_n"); + return ACE::send_n (this->get_handle (), + message_block, + timeout, + bytes_transferred); +} + // Recv an n byte message from the file. ASYS_INLINE ssize_t diff --git a/ace/Makefile b/ace/Makefile index 2f1bc6c9bf5..1a983aab876 100644 --- a/ace/Makefile +++ b/ace/Makefile @@ -42,6 +42,7 @@ UTILS_FILES = \ Handle_Set \ Init_ACE \ Lib_Find \ + Message_Block \ Method_Request \ Object_Manager \ Registry \ @@ -187,7 +188,6 @@ STREAMS_FILES = \ CDR_Base \ CDR_Stream \ Codeset_IBM1047 \ - Message_Block \ Message_Queue \ Task MEMORY_FILES = \ @@ -2976,6 +2976,8 @@ typedef unsigned int size_t; # define IOV_MAX 16 # endif /* IOV_MAX */ +#define ACE_IOV_MAX IOV_MAX + # if defined (ACE_PSOS_SNARFS_HEADER_INFO) // Header information snarfed from compiler provided header files // that are not included because there is already an identically diff --git a/ace/OS_Dirent.inl b/ace/OS_Dirent.inl index f9e0e7bceda..6f5574c8d7a 100644 --- a/ace/OS_Dirent.inl +++ b/ace/OS_Dirent.inl @@ -55,7 +55,7 @@ ACE_OS_Dirent::closedir (ACE_DIR *d) # if defined (ACE_WIN32) ACE_OS_Dirent::closedir_emulation (d); - delete d->directory_name_; + delete [] d->directory_name_; delete d; # else /* ACE_WIN32 */ ::closedir (d); diff --git a/ace/SOCK_Stream.h b/ace/SOCK_Stream.h index 6738b250dc5..f478702aaaa 100644 --- a/ace/SOCK_Stream.h +++ b/ace/SOCK_Stream.h @@ -22,6 +22,9 @@ #include "ace/INET_Addr.h" +// Forward declarations. +class ACE_Message_Block; + /** * @class ACE_SOCK_Stream * @@ -78,38 +81,45 @@ public: // = I/O functions. - /// Try to recv exactly <len> bytes into <buf> from <handle>. + /// Try to recv exactly <len> bytes into <buf> from the connected socket. ssize_t recv_n (void *buf, size_t len, int flags, const ACE_Time_Value *timeout = 0, size_t *bytes_transferred = 0) const; - /// Try to recv exactly <len> bytes into <buf> from <handle>. + /// Try to recv exactly <len> bytes into <buf> from the connected socket. ssize_t recv_n (void *buf, size_t len, const ACE_Time_Value *timeout = 0, size_t *bytes_transferred = 0) const; - /// Receive an <iovec> of size <iovcnt> to the connected socket. + /// Receive an <iovec> of size <iovcnt> from the connected socket. ssize_t recvv_n (iovec iov[], size_t iovcnt, const ACE_Time_Value *timeout = 0, size_t *bytes_transferred = 0) const; - /// Try to send exactly <len> bytes into <buf> from <handle>. + /// Try to send exactly <len> bytes from <buf> to the connection socket. ssize_t send_n (const void *buf, size_t len, int flags, const ACE_Time_Value *timeout = 0, size_t *bytes_transferred = 0) const; - /// Try to send exactly <len> bytes into <buf> from <handle>. + /// Try to send exactly <len> bytes from <buf> to the connected socket. ssize_t send_n (const void *buf, size_t len, const ACE_Time_Value *timeout = 0, size_t *bytes_transferred = 0) const; + /// Send all the <message_block>s chained through their <next> and + /// <cont> pointers. This call uses the underlying OS gather-write + /// operation to reduce the domain-crossing penalty. + ssize_t send_n (const ACE_Message_Block *message_block, + const ACE_Time_Value *timeout = 0, + size_t *bytes_transferred = 0) const; + /// Send an <iovec> of size <iovcnt> to the connected socket. ssize_t sendv_n (const iovec iov[], size_t iovcnt, diff --git a/ace/SOCK_Stream.i b/ace/SOCK_Stream.i index 4f483f43a03..0684e069832 100644 --- a/ace/SOCK_Stream.i +++ b/ace/SOCK_Stream.i @@ -133,6 +133,18 @@ ACE_SOCK_Stream::sendv_n (const iovec iov[], } ASYS_INLINE ssize_t +ACE_SOCK_Stream::send_n (const ACE_Message_Block *message_block, + const ACE_Time_Value *timeout, + size_t *bytes_transferred) const +{ + ACE_TRACE ("ACE_SOCK_Stream::send_n"); + return ACE::send_n (this->get_handle (), + message_block, + timeout, + bytes_transferred); +} + +ASYS_INLINE ssize_t ACE_SOCK_Stream::send_urg (const void *ptr, size_t len, const ACE_Time_Value *timeout) const diff --git a/ace/Svc_Handler.cpp b/ace/Svc_Handler.cpp index 2d5a78e0423..bba9693cca0 100644 --- a/ace/Svc_Handler.cpp +++ b/ace/Svc_Handler.cpp @@ -419,70 +419,24 @@ template <PR_ST_1, ACE_SYNCH_DECL> int ACE_Buffered_Svc_Handler<PR_ST_2, ACE_SYNCH_USE>::flush (void) { ACE_GUARD_RETURN (ACE_SYNCH_MUTEX_T, m, this->msg_queue ()->lock (), -1); - ACE_Message_Block *entry = 0; - iovec iov[IOV_MAX]; - size_t i = 0; - int result = 0; - // Iterate over all the <ACE_Message_Block>s in the - // <ACE_Message_Queue> and prepare them to be written out. - for (ACE_Message_Queue_Iterator<ACE_SYNCH_USE> iterator (*this->msg_queue ()); - iterator.next (entry) != 0 - && result == 0; - iterator.advance ()) - { - // Iterate over all the <Message_Block>s in a chain, including - // continuations. - for (ACE_Message_Block *temp = entry; - temp != 0; - temp = temp->cont ()) - { - iov[i].iov_len = temp->length (); - iov[i].iov_base = temp->rd_ptr (); - - i++; - - // Flush the <iovec>s when we've reached the maximum size - // for the platform. - if (i == IOV_MAX) - { -#if defined (ACE_DEBUGGING) - ACE_DEBUG ((LM_DEBUG, - "sending data (inside loop, i = %d)\n", - i)); -#endif /* ACE_DEBUGGING */ - // Send off the data. - if (this->peer ().sendv_n (iov, - i) == -1) - { - result = -1; - break; - } - i = 0; - } - } - } + ACE_Message_Queue_Iterator<ACE_SYNCH_USE> iterator (*this->msg_queue ()); + ACE_Message_Block *mblk; + int result = 0; - // Take care of any remaining <iovec>s. - if (i > 0 && result != -1) - { - if (this->peer ().sendv_n (iov, i) == -1) - result = -1; -#if defined (ACE_DEBUGGING) - ACE_DEBUG ((LM_DEBUG, - "sending data (final flush, i = %d)\n", - i)); -#endif /* ACE_DEBUGGING */ - } + // Get the first <ACE_Message_Block> so that we can write everything + // out via the <send_n>. + if (iterator.next (mblk) != 0) + result = this->peer ().send_n (mblk); // Remove all the <ACE_Message_Block>s in the <ACE_Message_Queue> // and <release> their memory. while (this->msg_queue ()->is_empty () == 0) { - if (this->msg_queue ()->dequeue_head (entry) == -1) + if (this->msg_queue ()->dequeue_head (mblk) == -1) break; - entry->release (); + mblk->release (); } if (this->timeoutp_ != 0) diff --git a/ace/Svc_Handler.h b/ace/Svc_Handler.h index fb0a18776fc..1be057134cb 100644 --- a/ace/Svc_Handler.h +++ b/ace/Svc_Handler.h @@ -6,11 +6,11 @@ * * $Id$ * - * @author Doug Schmidt and Irfan Pyrarli. + * @author Douglas Schmidt <schmidt@cs.wustl.edu> and + * Irfan Pyrarli <irfan@cs.wustl.edu> */ //============================================================================= - #ifndef ACE_SVC_HANDLER_H #define ACE_SVC_HANDLER_H #include "ace/pre.h" diff --git a/ace/WIN32_Asynch_IO.cpp b/ace/WIN32_Asynch_IO.cpp index 86730f3e2b9..69d504e3792 100644 --- a/ace/WIN32_Asynch_IO.cpp +++ b/ace/WIN32_Asynch_IO.cpp @@ -1938,14 +1938,14 @@ ACE_WIN32_Asynch_Read_Dgram::recv (ACE_Message_Block *message_block, -1); // do the scatter/gather recv - iovec iov[IOV_MAX]; + iovec iov[ACE_IOV_MAX]; int iovcnt = 0; for (const ACE_Message_Block* msg = message_block; msg != 0; msg = msg->cont ()) { iov[iovcnt].iov_base = msg->wr_ptr (); iov[iovcnt].iov_len = msg->size (); ++iovcnt; - if (iovcnt >= IOV_MAX) + if (iovcnt >= ACE_IOV_MAX) { delete result; return -1; @@ -2218,14 +2218,14 @@ ACE_WIN32_Asynch_Write_Dgram::send (ACE_Message_Block *message_block, -1); // do the scatter/gather recv - iovec iov[IOV_MAX]; + iovec iov[ACE_IOV_MAX]; int iovcnt = 0; for (const ACE_Message_Block* msg = message_block; msg != 0; msg = msg->cont ()) { iov[iovcnt].iov_base = msg->rd_ptr (); iov[iovcnt].iov_len = msg->length (); ++iovcnt; - if (iovcnt >= IOV_MAX) + if (iovcnt >= ACE_IOV_MAX) { delete result; return -1; diff --git a/ace/WIN32_Asynch_IO.h b/ace/WIN32_Asynch_IO.h index 7348967cf4d..8dba2c3cbfc 100644 --- a/ace/WIN32_Asynch_IO.h +++ b/ace/WIN32_Asynch_IO.h @@ -1396,7 +1396,7 @@ public: * errno to get the error code. * * Scatter/gather is supported on WIN32 by using the <message_block->cont()> - * method. Up to IOV_MAX <message_block>'s are supported. Upto + * method. Up to ACE_IOV_MAX <message_block>'s are supported. Upto * <message_block->size()> bytes will be read into each <message block> for * a total of <message_block->total_size()> bytes. All <message_block>'s * <wr_ptr>'s will be updated to reflect the added bytes for each @@ -1578,7 +1578,7 @@ public: * errno to get the error code. * * Scatter/gather is supported on WIN32 by using the <message_block->cont()> - * method. Up to IOV_MAX <message_block>'s are supported. Upto + * method. Up to ACE_IOV_MAX <message_block>'s are supported. Upto * <message_block->length()> bytes will be sent from each <message block> * for a total of <message_block->total_length()> bytes. All * <message_block>'s <rd_ptr>'s will be updated to reflect the bytes sent diff --git a/ace/config-win32-common.h b/ace/config-win32-common.h index 94fbb1edca4..cfd78ba0542 100644 --- a/ace/config-win32-common.h +++ b/ace/config-win32-common.h @@ -186,14 +186,14 @@ // that can be transferred by the scatter/gather type of I/O // functions, e.g., WSASend and WSARecv. We are arbitrarily setting // this to be 1k for now. The typically use case is to create an I/O -// vector array of size IOV_MAX on the stack and then filled in. Note -// that we probably don't want too big a value for IOV_MAX since it +// vector array of size ACE_IOV_MAX on the stack and then filled in. Note +// that we probably don't want too big a value for ACE_IOV_MAX since it // may mostly go to waste or the size of the activation record may // become excessively large. // -#if !defined (IOV_MAX) -# define IOV_MAX 1024 -#endif /* IOV_MAX */ +#if !defined (ACE_IOV_MAX) +# define ACE_IOV_MAX 1024 +#endif /* ACE_IOV_MAX */ #if !defined (ACE_HAS_WINCE) // Platform supports pread() and pwrite() diff --git a/tests/Svc_Handler_Test.cpp b/tests/Svc_Handler_Test.cpp index 4505059c324..a6c4b64a3ae 100644 --- a/tests/Svc_Handler_Test.cpp +++ b/tests/Svc_Handler_Test.cpp @@ -10,7 +10,8 @@ // // = DESCRIPTION // This tests illustrates the "buffering" strategy of the -// <ACE_Buffered_Svc_Handler>. +// <ACE_Buffered_Svc_Handler>. This test also illustrates how the +// <ACE_FILE_IO> classes work. // // = AUTHORS // Douglas C. Schmidt <schmidt@cs.wustl.edu> @@ -28,7 +29,7 @@ typedef ACE_Buffered_Svc_Handler <ACE_FILE_STREAM, ACE_NULL_SYNCH> SVC_HANDLER; static void run_test (SVC_HANDLER &svc_handler, - size_t iterations) + size_t iterations) { // Create a whole slew of message blocks and pass them to the // <svc_handler>. @@ -91,8 +92,7 @@ main (int argc, ACE_TCHAR *argv[]) ACE_FILE_Addr file (ACE_sap_any_cast (ACE_FILE_Addr &)); // Open up the temp file. - if (connector.connect (file_io, - file) == -1) + if (connector.connect (file_io, file) == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("connect failed for %p\n"), file.get_path_name ()), @@ -103,16 +103,6 @@ main (int argc, ACE_TCHAR *argv[]) # define TEST_CAN_UNLINK_IN_ADVANCE #endif -#if defined(TEST_CAN_UNLINK_IN_ADVANCE) - // Unlink this file right away so that it is automatically removed - // when the process exits. - if (file_io.unlink () == -1) - ACE_ERROR_RETURN ((LM_ERROR, - ACE_TEXT ("unlink failed for %p\n"), - file.get_path_name ()), - 1); -#endif - // Create the service handler and assign it <file_io> as its data // sink. SVC_HANDLER svc_handler (0, @@ -125,15 +115,32 @@ main (int argc, ACE_TCHAR *argv[]) // Run the test. run_test (svc_handler, iterations); -#if !defined(TEST_CAN_UNLINK_IN_ADVANCE) - file_io.close(); + file_io.close (); + + // Open up the temp file. + if (connector.connect (file_io, file) == -1) + ACE_ERROR_RETURN ((LM_ERROR, + ACE_TEXT ("connect failed for %p\n"), + file.get_path_name ()), + 1); + char buf[17]; + ACE_LOG_MSG->clr_flags (ACE_Log_Msg::VERBOSE_LITE); + + ACE_FILE_Info info; + file_io.get_info (info); + ACE_DEBUG ((LM_DEBUG, "file size = %d\n", info.size_)); + + for (ssize_t n_bytes; (n_bytes = file_io.recv (buf, sizeof buf)) > 0; ) + ACE_DEBUG ((LM_DEBUG, "%*s", n_bytes, buf)); + + ACE_DEBUG ((LM_DEBUG, "\n")); + + file_io.close (); if (file_io.unlink () == -1) ACE_ERROR_RETURN ((LM_ERROR, ACE_TEXT ("unlink failed for %p\n"), file.get_path_name ()), 1); -#endif - } ACE_END_TEST; |