apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stodd...@apache.org
Subject cvs commit: apr/network_io/win32 sendrecv.c
Date Sun, 01 Jul 2001 15:13:35 GMT
stoddard    01/07/01 08:13:35

  Modified:    network_io/win32 sendrecv.c
  Log:
  Back out this portion of Bill Rowe's large file support patch.  We should not
  use the event handle in the apr_file_t to do overlapped i/o on a socket. We
  either need to wait for io completion on the socket or create a thread specific
  event handle.  This fixes the seg fault we were seeing when serving a cached
  file on Windows.
  
  Revision  Changes    Path
  1.41      +14 -18    apr/network_io/win32/sendrecv.c
  
  Index: sendrecv.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/win32/sendrecv.c,v
  retrieving revision 1.40
  retrieving revision 1.41
  diff -u -r1.40 -r1.41
  --- sendrecv.c	2001/06/06 16:05:26	1.40
  +++ sendrecv.c	2001/07/01 15:13:34	1.41
  @@ -258,16 +258,12 @@
   
       /* Initialize the overlapped structure */
       memset(&overlapped,'\0', sizeof(overlapped));
  -    if (file->pOverlapped)
  -        overlapped.hEvent = file->pOverlapped->hEvent;
  -#ifdef WAIT_FOR_EVENT
  -    else
  -        overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
  -#endif
       if (offset && *offset) {
  -        file->pOverlapped->Offset     = (DWORD)*offset;
  -        file->pOverlapped->OffsetHigh = (DWORD)(*offset >> 32);
  +        overlapped.Offset = *offset;
       }
  +#ifdef WAIT_FOR_EVENT
  +    overlapped.hEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
  +#endif
   
       /* Handle the goofy case of sending headers/trailers and a zero byte file */
       if (!bytes_to_send && hdtr) {
  @@ -324,14 +320,15 @@
           if (!rv) {
               status = apr_get_netos_error();
               if (status == APR_FROM_OS_ERROR(ERROR_IO_PENDING)) {
  -                if (overlapped.hEvent)
  -                    rv = WaitForSingleObject(overlapped.hEvent, 
  -                                             (DWORD)(sock->timeout >= 0 
  -                                                ? sock->timeout : INFINITE));
  -                else
  -                    rv = WaitForSingleObject((HANDLE) sock->sock, 
  -                                             (DWORD)(sock->timeout >= 0 
  -                                                ? sock->timeout : INFINITE));
  +#ifdef WAIT_FOR_EVENT
  +                rv = WaitForSingleObject(overlapped.hEvent, 
  +                                         (DWORD)(sock->timeout >= 0 
  +                                            ? sock->timeout : INFINITE));
  +#else
  +                rv = WaitForSingleObject((HANDLE) sock->sock, 
  +                                         (DWORD)(sock->timeout >= 0 
  +                                            ? sock->timeout : INFINITE));
  +#endif
                   if (rv == WAIT_OBJECT_0)
                       status = APR_SUCCESS;
                   else if (rv == WAIT_TIMEOUT)
  @@ -379,8 +376,7 @@
       }
   
   #ifdef WAIT_FOR_EVENT
  -    if (!file->pOverlapped || !file->pOverlapped->hEvent)
  -        CloseHandle(overlapped.hEvent);
  +    CloseHandle(overlapped.hEvent);
   #endif
       return status;
   }
  
  
  

Mime
View raw message