cvs commit: apache-apr/pthreads/src/main buff.c

1999-06-10 Thread manoj
manoj   99/06/09 20:38:33

  Modified:pthreads/src/main buff.c
  Log:
  Warning scrubbing.
  
  Revision  ChangesPath
  1.13  +1 -1  apache-apr/pthreads/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /home/cvs/apache-apr/pthreads/src/main/buff.c,v
  retrieving revision 1.12
  retrieving revision 1.13
  diff -u -d -u -r1.12 -r1.13
  --- buff.c1999/06/09 22:03:39 1.12
  +++ buff.c1999/06/10 03:38:32 1.13
  @@ -1300,7 +1300,7 @@
*/
   API_EXPORT(int) ap_bclose(BUFF *fb)
   {
  -int rc1, rc2, rc3;
  +int rc1, rc2;
   
   if (fb->flags & B_WR)
rc1 = ap_bflush(fb);
  
  
  


cvs commit: apache-apr/pthreads/src/main buff.c

1999-06-03 Thread manoj
manoj   99/06/03 16:37:45

  Modified:pthreads/src/main buff.c
  Log:
  Now, {send,recv}withtimeout can handle both non-blocking I/O (timeout =
  0), and fully blocking I/O (timeout = -1). This makes these routines
  look more like the APR functions.
  
  Revision  ChangesPath
  1.10  +6 -6  apache-apr/pthreads/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /home/cvs/apache-apr/pthreads/src/main/buff.c,v
  retrieving revision 1.9
  retrieving revision 1.10
  diff -u -u -r1.9 -r1.10
  --- buff.c1999/06/01 21:36:03 1.9
  +++ buff.c1999/06/03 23:37:44 1.10
  @@ -126,18 +126,18 @@
   int err = EAGAIN;
   int rv;
   
  -tv.tv_sec = sec;
  -if (tv.tv_sec == 0) {
  +if (sec == -1) {
   return (write(sock, buf, len));
   }
   ap_bnonblock(sock);
   rv = write(sock, buf, len);
   
  -if (rv == -1) {
  +if (rv == -1 && sec != 0) {
   err = errno;
if (err == EAGAIN || errno == EINTR) {
FD_ZERO(&fdset);
FD_SET(sock, &fdset);
  +tv.tv_sec = sec;
tv.tv_usec = 0;
   do {
rv = select(FD_SETSIZE, NULL, &fdset, NULL, &tv);
  @@ -161,17 +161,17 @@
   int err = EAGAIN;
   int rv;
   
  -tv.tv_sec = sec;
  -if (tv.tv_sec == 0) {
  +if (sec == -1) {
return (read(sock, buf, len));
   }
   ap_bnonblock(sock);
   rv = read(sock, buf, len);
  -if (rv == -1) {
  +if (rv == -1 && sec != 0) {
err = errno;
if (err == EAGAIN || errno == EINTR) {
FD_ZERO(&fdset);
FD_SET(sock, &fdset);
  +tv.tv_sec = sec;
tv.tv_usec = 0;
do {
   rv = select(FD_SETSIZE, &fdset, NULL, NULL, &tv);
  
  
  


cvs commit: apache-apr/pthreads/src/main buff.c

1999-06-01 Thread manoj
manoj   99/06/01 14:36:03

  Modified:pthreads/src/main buff.c
  Log:
  Clean out the WIN32, etc. code in the buff routines. This lets us get
  rid of a few layers of function calls too, and the Windows, etc.
  functionality will be put back with the portable runtime work.
  
  Revision  ChangesPath
  1.9   +13 -250   apache-apr/pthreads/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /home/cvs/apache-apr/pthreads/src/main/buff.c,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -u -r1.8 -r1.9
  --- buff.c1999/05/07 06:57:50 1.8
  +++ buff.c1999/06/01 21:36:03 1.9
  @@ -119,120 +119,10 @@
* futher I/O will be done
*/
   
  -#ifdef WIN32
  -
  -/*
  -  select() sometimes returns 1 even though the write will block. We must 
work around this.
  -*/
  -
  -static int sendwithtimeout(int sock, const char *buf, int len, int flags, 
int sec)
  +static int sendwithtimeout(int sock, const char *buf, int len, time_t sec)
   {
  -int iostate = 1;
   fd_set fdset;
   struct timeval tv;
  -int err = WSAEWOULDBLOCK;
  -int rv;
  -int retry;
  -
  -if (!(tv.tv_sec = ap_check_alarm()))
  - return (send(sock, buf, len, flags));
  -
  -rv = ioctlsocket(sock, FIONBIO, &iostate);
  -iostate = 0;
  -if (rv) {
  - err = WSAGetLastError();
  - ap_assert(0);
  -}
  -rv = send(sock, buf, len, flags);
  -if (rv == SOCKET_ERROR) {
  - err = WSAGetLastError();
  - if (err == WSAEWOULDBLOCK)
  - do {
  - retry=0;
  -
  - FD_ZERO(&fdset);
  - FD_SET(sock, &fdset);
  - tv.tv_usec = 0;
  - rv = select(FD_SETSIZE, NULL, &fdset, NULL, &tv);
  - if (rv == SOCKET_ERROR)
  - err = WSAGetLastError();
  - else if (rv == 0) {
  - ioctlsocket(sock, FIONBIO, &iostate);
  - if(ap_check_alarm() < 0) {
  - WSASetLastError(EINTR); /* Simulate an alarm() */
  - return (SOCKET_ERROR);
  - }
  - }
  - else {
  - rv = send(sock, buf, len, flags);
  - if (rv == SOCKET_ERROR) {
  - err = WSAGetLastError();
  - if(err == WSAEWOULDBLOCK) {
  - ap_log_error(APLOG_MARK,APLOG_DEBUG,NULL,
  - "select claimed we could write, but in fact we 
couldn't. This is a bug in Windows.");
  - retry=1;
  - Sleep(100);
  - }
  - }
  - }
  - } while(retry);
  -}
  -ioctlsocket(sock, FIONBIO, &iostate);
  -if (rv == SOCKET_ERROR)
  - WSASetLastError(err);
  -return (rv);
  -}
  -
  -
  -static int recvwithtimeout(int sock, char *buf, int len, int flags, int sec)
  -{
  -int iostate = 1;
  -fd_set fdset;
  -struct timeval tv;
  -int err = WSAEWOULDBLOCK;
  -int rv;
  -
  -if (!(tv.tv_sec = ap_check_alarm()))
  - return (recv(sock, buf, len, flags));
  -
  -rv = ioctlsocket(sock, FIONBIO, &iostate);
  -iostate = 0;
  -ap_assert(!rv);
  -rv = recv(sock, buf, len, flags);
  -if (rv == SOCKET_ERROR) {
  - err = WSAGetLastError();
  - if (err == WSAEWOULDBLOCK) {
  - FD_ZERO(&fdset);
  - FD_SET(sock, &fdset);
  - tv.tv_usec = 0;
  - rv = select(FD_SETSIZE, &fdset, NULL, NULL, &tv);
  - if (rv == SOCKET_ERROR)
  - err = WSAGetLastError();
  - else if (rv == 0) {
  - ioctlsocket(sock, FIONBIO, &iostate);
  - ap_check_alarm();
  - WSASetLastError(WSAEWOULDBLOCK);
  - return (SOCKET_ERROR);
  - }
  - else {
  - rv = recv(sock, buf, len, flags);
  - if (rv == SOCKET_ERROR)
  - err = WSAGetLastError();
  - }
  - }
  -}
  -ioctlsocket(sock, FIONBIO, &iostate);
  -if (rv == SOCKET_ERROR)
  - WSASetLastError(err);
  -return (rv);
  -}
  -
  -#else
  -
  -static int sendwithtimeout(int sock, const char *buf, int len, int flags, 
time_t sec)
  -{
  -fd_set fdset;
  -struct timeval tv;
   int err = EAGAIN;
   int rv;
   
  @@ -264,7 +154,7 @@
   return (rv);
   }
   
  -static int recvwithtimeout(int sock, char *buf, int len, int flags, time_t 
sec)
  +static int recvwithtimeout(int sock, char *buf, int len, time_t sec)
   {
   fd_set fdset;
   struct timeval tv;
  @@ -300,101 +190,6 @@
   return (rv);
   }
   
  -#endif /* WIN32 */
  -
  -
  -/* the lowest level reading primitive */
  -static int ap_read(BUFF *fb, void *buf, int nbyte)
  -{
  -int rv;
  -
  -#ifdef WIN32
  -if (fb->hFH != INVALID_HANDLE_VALUE) {
  -if (!ReadFile(fb->hFH,buf,n

cvs commit: apache-apr/pthreads/src/main buff.c

1999-05-07 Thread manoj
manoj   99/05/06 23:57:50

  Modified:pthreads/src/main buff.c
  Log:
  typo
  
  Revision  ChangesPath
  1.8   +1 -1  apache-apr/pthreads/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /home/cvs/apache-apr/pthreads/src/main/buff.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -u -r1.7 -r1.8
  --- buff.c1999/04/09 04:10:36 1.7
  +++ buff.c1999/05/07 06:57:50 1.8
  @@ -623,7 +623,7 @@
   #elif defined(O_NDELAY)
   fd_flags |= O_NDELAY;
   return fcntl(fd, F_SETFL, fd_flags);
  -#eli f defined(FNDELAY)
  +#elif defined(FNDELAY)
   fd_flags |= O_FNDELAY;
   return fcntl(fd, F_SETFL, fd_flags);
   #else
  
  
  


cvs commit: apache-apr/pthreads/src/main buff.c

1999-03-15 Thread rbb
rbb 99/03/15 10:22:33

  Modified:pthreads/src/main buff.c
  Log:
  Fix recv and send withtimeout.  I used recv and send instead or read and 
write.
  
  Revision  ChangesPath
  1.5   +7 -6  apache-apr/pthreads/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /home/cvs/apache-apr/pthreads/src/main/buff.c,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- buff.c1999/03/15 14:26:49 1.4
  +++ buff.c1999/03/15 18:22:31 1.5
  @@ -238,10 +238,11 @@
   
   tv.tv_sec = sec;
   if (tv.tv_sec == 0) {
  -return (send(sock, buf, len, flags));
  +return (write(sock, buf, len));
   }
   ap_bnonblock(sock);
  -rv = send(sock, buf, len, flags);
  +rv = write(sock, buf, len);
  +
   if (rv == -1) {
   err = errno;
if (err == EAGAIN || errno == EINTR) {
  @@ -255,7 +256,7 @@
err = errno;
}
else {
  - rv = send(sock, buf, len, flags);
  + rv = write(sock, buf, len);
}
}
   }
  @@ -272,10 +273,10 @@
   
   tv.tv_sec = sec;
   if (tv.tv_sec == 0) {
  - return (recv(sock, buf, len, flags));
  + return (read(sock, buf, len));
   }
   ap_bnonblock(sock);
  -rv = recv(sock, buf, len, flags);
  +rv = read(sock, buf, len);
   if (rv == -1) {
err = errno;
if (err == EAGAIN || errno == EINTR) {
  @@ -289,7 +290,7 @@
err = errno;
}
else {
  - rv = recv(sock, buf, len, flags);
  + rv = read(sock, buf, len);
if (rv == -1)
err = errno;
}
  
  
  


cvs commit: apache-apr/pthreads/src/main buff.c http_core.c http_main.c http_protocol.c

1999-02-24 Thread rbb
rbb 99/02/24 12:30:20

  Modified:pthreads/src/include http_main.h httpd.h
   pthreads/src/main buff.c http_core.c http_main.c
http_protocol.c
  Log:
  Implemented timeouts in the hybrid server.  We are using non_blocking I/O
  and and poll to implement the timeouts.  I will probably just implement
  recvwithtimeout on all systems, but this change lets us do some testing.  The
  overall logic won't change with any subsequent change, just where the
  waiting is done.  In order to use poll, we have to have our timeouts in
  milliseconds, so I convert from sec -> millisec when the user specifies a
  timeout in the config file.  Lastly, I set the default timeout to 2 min. 
instead
  of five.  May not be a good idea, but it helps me test easier.  We can set it
  higher later if we have to.
  
  Revision  ChangesPath
  1.4   +1 -0  apache-apr/pthreads/src/include/http_main.h
  
  Index: http_main.h
  ===
  RCS file: /home/cvs/apache-apr/pthreads/src/include/http_main.h,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- http_main.h   1999/02/09 21:39:52 1.3
  +++ http_main.h   1999/02/24 20:30:14 1.4
  @@ -115,6 +115,7 @@
   void ap_start_shutdown(void);
   void ap_start_restart(int);
   void ap_keepalive_timeout(char *, request_rec *);
  +int ap_get_timeout(request_rec *r);
   
   API_EXPORT(void) ap_child_terminate(request_rec *r);
   int ap_update_child_status(int child_num, int thread_num, int status, 
request_rec *r);
  
  
  
  1.9   +2 -2  apache-apr/pthreads/src/include/httpd.h
  
  Index: httpd.h
  ===
  RCS file: /home/cvs/apache-apr/pthreads/src/include/httpd.h,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- httpd.h   1999/02/16 16:00:47 1.8
  +++ httpd.h   1999/02/24 20:30:14 1.9
  @@ -258,12 +258,12 @@
   
   /* The timeout for waiting for messages */
   #ifndef DEFAULT_TIMEOUT
  -#define DEFAULT_TIMEOUT 300
  +#define DEFAULT_TIMEOUT 12 
   #endif
   
   /* The timeout for waiting for keepalive timeout until next request */
   #ifndef DEFAULT_KEEPALIVE_TIMEOUT
  -#define DEFAULT_KEEPALIVE_TIMEOUT 15
  +#define DEFAULT_KEEPALIVE_TIMEOUT 15000
   #endif
   
   /* The number of requests to entertain per connection */
  
  
  
  1.3   +31 -5 apache-apr/pthreads/src/main/buff.c
  
  Index: buff.c
  ===
  RCS file: /home/cvs/apache-apr/pthreads/src/main/buff.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- buff.c1999/02/07 06:29:30 1.2
  +++ buff.c1999/02/24 20:30:16 1.3
  @@ -539,18 +539,44 @@
   return value;
   }
   
  -
   API_EXPORT(int) ap_bnonblock(BUFF *fb, int direction)
   {
   APRFile fd;
  +int fd_flags;
  +
  +fd = (direction == B_RD) ? fb->fd_in : fb->fd;
  +fd_flags = fcntl(fd, F_GETFL, 0);
  +#if defined(O_NONBLOCK)
  +fd_flags |= O_NONBLOCK;
  +return fcntl(fd, F_SETFL, fd_flags);
  +#elif defined(O_NDELAY)
  +fd_flags |= O_NDELAY;
  +return fcntl(fd, F_SETFL, fd_flags);
  +#eli f defined(FNDELAY)
  +fd_flags |= O_FNDELAY;
  +return fcntl(fd, F_SETFL, fd_flags);
  +#else
  +/* : this breaks things, but an alternative isn't obvious...*/
  +return 0;
  +#endif
  +}
  +
  +API_EXPORT(int) ap_bblock(BUFF *fb, int direction)
  +{
  +APRFile fd;
  +int fd_flags;
   
   fd = (direction == B_RD) ? fb->fd_in : fb->fd;
  +fd_flags = fcntl(fd, F_GETFL, 0);
   #if defined(O_NONBLOCK)
  -return fcntl(fd, F_SETFL, O_NONBLOCK);
  +fd_flags &= ~O_NONBLOCK;
  +return fcntl(fd, F_SETFL, fd_flags);
   #elif defined(O_NDELAY)
  -return fcntl(fd, F_SETFL, O_NDELAY);
  -#elif defined(FNDELAY)
  -return fcntl(fd, F_SETFL, FNDELAY);
  +fd_flags &= ~O_NDELAY;
  +return fcntl(fd, F_SETFL, fd_flags);
  +#eli f defined(FNDELAY)
  +fd_flags &= ~O_FNDELAY;
  +return fcntl(fd, F_SETFL, fd_flags);
   #else
   /* : this breaks things, but an alternative isn't obvious...*/
   return 0;
  
  
  
  1.8   +2 -2  apache-apr/pthreads/src/main/http_core.c
  
  Index: http_core.c
  ===
  RCS file: /home/cvs/apache-apr/pthreads/src/main/http_core.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- http_core.c   1999/02/23 19:11:21 1.7
  +++ http_core.c   1999/02/24 20:30:17 1.8
  @@ -1965,7 +1965,7 @@
   return err;
   }
   
  -cmd->server->timeout = atoi(arg);
  +cmd->server->timeout = atoi(arg) * 1000;
   return NULL;
   }
   
  @@ -1977,7 +1977,7 @@
   return err;
   }
   
  -cmd->server->keep_alive_timeout = atoi(arg);
  +cmd->server->keep_ali