summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrooneg <rooneg@13f79535-47bb-0310-9956-ffa450edef68>2006-01-26 21:50:48 +0000
committerrooneg <rooneg@13f79535-47bb-0310-9956-ffa450edef68>2006-01-26 21:50:48 +0000
commit7965c49f6f9de87c7c5bcb10489eb85a6aa6334b (patch)
tree70f1e081813a8b0c76f829a697dd1073490cfd73
parent703c83ca97ce638c548bf3afe22d08f9a959017b (diff)
downloadlibapr-7965c49f6f9de87c7c5bcb10489eb85a6aa6334b.tar.gz
Merge r355812 to 0.9.x.
Original log message: Cause apr_file_write_full on win32 to consider the timeout value set by apr_file_pipe_timeout_set. PR 30182 <eholyat olf.com> [also note the last changes are all still tracking to 1.3.0] git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/0.9.x@372622 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--CHANGES4
-rw-r--r--file_io/win32/readwrite.c16
2 files changed, 18 insertions, 2 deletions
diff --git a/CHANGES b/CHANGES
index 7be98a0f0..b62c31078 100644
--- a/CHANGES
+++ b/CHANGES
@@ -2,6 +2,10 @@ Changes with APR 0.9.8-dev
*) Keep testpipe.c from hanging on win32. [Garrett Rooney]
+ *) Cause apr_file_write_full on win32 to consider the timeout value set by
+ apr_file_pipe_timeout_set. PR 30182
+ [<eholyat olf.com>]
+
*) Fix assertion from double close of a handle with a rwlock on win32.
[Evgueni Brevnov <evgueni.brevnov gmail.com>]
diff --git a/file_io/win32/readwrite.c b/file_io/win32/readwrite.c
index 988c21f4f..4b918cf9b 100644
--- a/file_io/win32/readwrite.c
+++ b/file_io/win32/readwrite.c
@@ -308,8 +308,20 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a
(*nbytes) = 0;
rv = apr_get_os_error();
if (rv == APR_FROM_OS_ERROR(ERROR_IO_PENDING)) {
- /* Wait for the pending i/o (put a timeout here?) */
- rv = WaitForSingleObject(thefile->pOverlapped->hEvent, INFINITE);
+
+ DWORD timeout_ms;
+
+ if (thefile->timeout == 0) {
+ timeout_ms = 0;
+ }
+ else if (thefile->timeout < 0) {
+ timeout_ms = INFINITE;
+ }
+ else {
+ timeout_ms = thefile->timeout / 1000;
+ }
+
+ rv = WaitForSingleObject(thefile->pOverlapped->hEvent, timemilliseconds);
switch (rv) {
case WAIT_OBJECT_0:
GetOverlappedResult(thefile->filehand, thefile->pOverlapped, nbytes, TRUE);