summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--ChangeLogs/ChangeLog-02a8
-rw-r--r--ChangeLogs/ChangeLog-03a8
-rw-r--r--ace/ACE.cpp88
-rw-r--r--ace/ACE.h9
-rw-r--r--websvcs/lib/URL_Addr.cpp1
-rw-r--r--websvcs/lib/URL_Addr.h2
7 files changed, 121 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index c13663b9fd6..fa961aabe0e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+Sat Aug 18 13:18:10 2001 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu>
+
+ * ace/ACE.{h,cpp}: Added a new write_n(...ACE_Message_Block *...)
+ for file transfers that's the dual of
+ send_n(...ACE_Message_Block *...). This helps out the C++NPv1
+ book symmetry. Thanks to Alain Decamps <Alain.Decamps@PIDPA.be>
+ for motivating this.
+
Fri Aug 17 18:17:38 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
* bin/clone.cpp: Only use extern char *sys_errlist[] if we're not
diff --git a/ChangeLogs/ChangeLog-02a b/ChangeLogs/ChangeLog-02a
index c13663b9fd6..fa961aabe0e 100644
--- a/ChangeLogs/ChangeLog-02a
+++ b/ChangeLogs/ChangeLog-02a
@@ -1,3 +1,11 @@
+Sat Aug 18 13:18:10 2001 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu>
+
+ * ace/ACE.{h,cpp}: Added a new write_n(...ACE_Message_Block *...)
+ for file transfers that's the dual of
+ send_n(...ACE_Message_Block *...). This helps out the C++NPv1
+ book symmetry. Thanks to Alain Decamps <Alain.Decamps@PIDPA.be>
+ for motivating this.
+
Fri Aug 17 18:17:38 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
* bin/clone.cpp: Only use extern char *sys_errlist[] if we're not
diff --git a/ChangeLogs/ChangeLog-03a b/ChangeLogs/ChangeLog-03a
index c13663b9fd6..fa961aabe0e 100644
--- a/ChangeLogs/ChangeLog-03a
+++ b/ChangeLogs/ChangeLog-03a
@@ -1,3 +1,11 @@
+Sat Aug 18 13:18:10 2001 Douglas C. Schmidt <schmidt@ace.cs.wustl.edu>
+
+ * ace/ACE.{h,cpp}: Added a new write_n(...ACE_Message_Block *...)
+ for file transfers that's the dual of
+ send_n(...ACE_Message_Block *...). This helps out the C++NPv1
+ book symmetry. Thanks to Alain Decamps <Alain.Decamps@PIDPA.be>
+ for motivating this.
+
Fri Aug 17 18:17:38 2001 Douglas C. Schmidt <schmidt@macarena.cs.wustl.edu>
* bin/clone.cpp: Only use extern char *sys_errlist[] if we're not
diff --git a/ace/ACE.cpp b/ace/ACE.cpp
index 0e351575fcc..45383430153 100644
--- a/ace/ACE.cpp
+++ b/ace/ACE.cpp
@@ -2067,6 +2067,94 @@ ACE::sendv_n_i (ACE_HANDLE handle,
return bytes_transferred;
}
+ASYS_INLINE ssize_t
+ACE::write_n (ACE_HANDLE handle,
+ const ACE_Message_Block *message_block,
+ size_t *bt)
+{
+ size_t temp;
+ size_t &bytes_transferred = bt == 0 ? temp : *bt;
+ bytes_transferred = 0;
+
+ iovec iov[ACE_IOV_MAX];
+ int iovcnt = 0;
+
+ while (message_block != 0)
+ {
+ // Our current message block chain.
+ const ACE_Message_Block *current_message_block = message_block;
+
+ while (current_message_block != 0)
+ {
+ size_t current_message_block_length =
+ current_message_block->length ();
+
+ // Check if this block has any data to be sent.
+ if (current_message_block_length > 0)
+ {
+ // Collect the data in the iovec.
+ iov[iovcnt].iov_base = current_message_block->rd_ptr ();
+ iov[iovcnt].iov_len = current_message_block_length;
+
+ // Increment iovec counter.
+ iovcnt++;
+
+ // The buffer is full make a OS call. @@ TODO find a way to
+ // 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 == ACE_IOV_MAX)
+ {
+ size_t current_transfer = 0;
+
+ ssize_t result = ACE::writev_n (handle,
+ iov,
+ iovcnt,
+ &current_transfer);
+
+ // Add to total bytes transferred.
+ bytes_transferred += current_transfer;
+
+ // Errors.
+ if (result == -1 || result == 0)
+ return result;
+
+ // Reset iovec counter.
+ iovcnt = 0;
+ }
+ }
+
+ // Select the next message block in the chain.
+ current_message_block = current_message_block->cont ();
+ }
+
+ // Selection of the next message block chain.
+ message_block = message_block->next ();
+ }
+
+ // Check for remaining buffers to be sent. This will happen when
+ // ACE_IOV_MAX is not a multiple of the number of message blocks.
+ if (iovcnt != 0)
+ {
+ size_t current_transfer = 0;
+
+ ssize_t result = ACE::writev_n (handle,
+ iov,
+ iovcnt,
+ &current_transfer);
+
+ // Add to total bytes transferred.
+ bytes_transferred += current_transfer;
+
+ // Errors.
+ if (result == -1 || result == 0)
+ return result;
+ }
+
+ // Return total bytes transferred.
+ return bytes_transferred;
+}
+
ssize_t
ACE::send_n (ACE_HANDLE handle,
const ACE_Message_Block *message_block,
diff --git a/ace/ACE.h b/ace/ACE.h
index 2f348b87ded..4870720b150 100644
--- a/ace/ACE.h
+++ b/ace/ACE.h
@@ -278,7 +278,7 @@ public:
/// 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.
+ /// operation to 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,
@@ -296,6 +296,13 @@ public:
size_t len,
size_t *bytes_transferred = 0);
+ /// Write 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.
+ static ssize_t write_n (ACE_HANDLE handle,
+ const ACE_Message_Block *message_block,
+ size_t *bytes_transferred = 0);
+
static ssize_t readv_n (ACE_HANDLE handle,
iovec *iov,
int iovcnt,
diff --git a/websvcs/lib/URL_Addr.cpp b/websvcs/lib/URL_Addr.cpp
index 14abe7661d0..43a471075aa 100644
--- a/websvcs/lib/URL_Addr.cpp
+++ b/websvcs/lib/URL_Addr.cpp
@@ -15,7 +15,6 @@ static size_t ftp_size = sizeof(ftp)/sizeof(ftp[0]) - 1;
static ACE_TCHAR mailto[] = ACE_TEXT ("mailto:");
static size_t mailto_size = sizeof(mailto)/sizeof(mailto[0]) - 1;
-
static ACE_TCHAR file[] = ACE_TEXT ("file:");
static size_t file_size = sizeof(file)/sizeof(file[0]) - 1;
static ACE_TCHAR afs[] = ACE_TEXT ("afs:");
diff --git a/websvcs/lib/URL_Addr.h b/websvcs/lib/URL_Addr.h
index 432b44a0f94..c83edf69440 100644
--- a/websvcs/lib/URL_Addr.h
+++ b/websvcs/lib/URL_Addr.h
@@ -181,7 +181,7 @@ public:
// Destructor
ACE_INET_Addr get_inet_address (void) const;
- // Build the INET_Address implicit in the URL, notice that we
+ // Build the INET_Address implicit in the URL, notice that we
// maintain the hostname in its string representation, because the
// URL can be can be refering to an hostname that cannot be
// validated at this point.