summaryrefslogtreecommitdiff
path: root/file_io
diff options
context:
space:
mode:
authorIvan Zhakov <ivan@apache.org>2022-01-20 14:27:19 +0000
committerIvan Zhakov <ivan@apache.org>2022-01-20 14:27:19 +0000
commit011f944967c77b5608eaebf4cdc1947b7340d804 (patch)
tree713bdb8fb020d401680b99c9342207e997f8701c /file_io
parenta484479e9e36e50fd870eb223c5043fa90211ea4 (diff)
downloadapr-011f944967c77b5608eaebf4cdc1947b7340d804.tar.gz
On 'win32-pollset-wakeup-no-file-socket-emulation' branch:
Remove code in win32 apr_file_t implementation that emulates working with sockets as files. Sockets on Windows are not kernel objects and should be used only via Winsock API. * file_io/win32/readwrite.c (): Do not include apr_arch_networkio.h. (read_with_timeout): Remove APR_FILETYPE_SOCKET support code. * include/arch/win32/apr_arch_file_io.h (apr_filetype_e): Remove APR_FILETYPE_SOCKET enum value. git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/win32-pollset-wakeup-no-file-socket-emulation@1897254 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'file_io')
-rw-r--r--file_io/win32/readwrite.c42
1 files changed, 5 insertions, 37 deletions
diff --git a/file_io/win32/readwrite.c b/file_io/win32/readwrite.c
index 0ce9f82cc..c9d4864ed 100644
--- a/file_io/win32/readwrite.c
+++ b/file_io/win32/readwrite.c
@@ -20,7 +20,6 @@
#include "apr_strings.h"
#include "apr_lib.h"
#include "apr_errno.h"
-#include "apr_arch_networkio.h"
#include "apr_arch_atime.h"
#include "apr_arch_misc.h"
@@ -74,23 +73,8 @@ static apr_status_t read_with_timeout(apr_file_t *file, void *buf, apr_size_t le
file->pOverlapped->OffsetHigh = (DWORD)(file->filePtr >> 32);
}
- if (file->ftype == APR_FILETYPE_SOCKET) {
- WSABUF wsaData;
- DWORD flags = 0;
-
- wsaData.buf = (char*) buf;
- wsaData.len = (u_long)len;
- if (WSARecv((SOCKET)file->filehand, &wsaData, 1, &bytesread,
- &flags, NULL, NULL) == SOCKET_ERROR) {
- rv = apr_get_netos_error();
- bytesread = 0;
- }
- else {
- rv = APR_SUCCESS;
- }
- }
- else if (ReadFile(file->filehand, buf, len,
- &bytesread, file->pOverlapped)) {
+ if (ReadFile(file->filehand, buf, len,
+ &bytesread, file->pOverlapped)) {
rv = APR_SUCCESS;
}
else {
@@ -426,25 +410,9 @@ APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *thefile, const void *buf, a
if (thefile->flags & APR_FOPEN_XTHREAD) {
apr_thread_mutex_unlock(thefile->mutex);
}
- }
- else if (thefile->ftype == APR_FILETYPE_SOCKET) {
- WSABUF wsaData;
- DWORD flags = 0;
-
- wsaData.buf = (char*) buf;
- wsaData.len = (u_long)*nbytes;
- if (WSASend((SOCKET)thefile->filehand, &wsaData, 1, &bwrote,
- flags, NULL, NULL) == SOCKET_ERROR) {
- rv = apr_get_netos_error();
- bwrote = 0;
- }
- else {
- rv = APR_SUCCESS;
- }
- *nbytes = bwrote;
- }
- else {
- if (thefile->ftype != APR_FILETYPE_FILE) {
+ return rv;
+ } else {
+ if (thefile->ftype == APR_FILETYPE_PIPE) {
rv = WriteFile(thefile->filehand, buf, (DWORD)*nbytes, &bwrote,
thefile->pOverlapped);
}