Hi All,
I suspect that read_with_timeout (in file_io/win32/readwrite.c) may drop
data if
(i) WaitForSingleObject (line 82) returns WAIT_TIMEOUT, and
(ii) Data arrived before the execution arrives at CancelIo (line 105).
Tried the attached patch and the problem seems solved. I'm a novice of
Windows' file mgmt API and would appreciate if somebody can validate
this patch.
Regards,
Norris Leong
diff -ruN apr-1.2.2.orig/file_io/win32/readwrite.c apr-1.2.2/file_io/win32/readwrite.c
--- apr-1.2.2.orig/file_io/win32/readwrite.c 2006-01-20 11:46:52.000000000 +0800
+++ apr-1.2.2/file_io/win32/readwrite.c 2006-01-20 11:41:13.000000000 +0800
@@ -102,7 +102,12 @@
}
if (rv != APR_SUCCESS) {
if (apr_os_level >= APR_WIN_98)
+ {
CancelIo(file->filehand);
+ if (GetOverlappedResult(file->filehand, file->pOverlapped,
+ (LPDWORD)nbytes, TRUE))
+ rv = APR_SUCCESS;
+ }
}
}
else if (rv == APR_FROM_OS_ERROR(ERROR_BROKEN_PIPE)) {