httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ma...@hyperreal.org
Subject cvs commit: apache-2.0/src/lib/apr/network_io/unix networkio.h sockets.c sockopt.c
Date Fri, 08 Oct 1999 19:44:38 GMT
manoj       99/10/08 12:44:36

  Modified:    src/lib/apr/network_io/unix networkio.h sockets.c sockopt.c
  Log:
  Every accept() was resulting in a reverse name lookup. This eliminates it.
  
  Revision  Changes    Path
  1.5       +0 -1      apache-2.0/src/lib/apr/network_io/unix/networkio.h
  
  Index: networkio.h
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/networkio.h,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -d -u -r1.4 -r1.5
  --- networkio.h	1999/10/01 16:18:34	1.4
  +++ networkio.h	1999/10/08 19:44:30	1.5
  @@ -65,7 +65,6 @@
   struct socket_t {
       ap_context_t *cntxt;
       int socketdes;
  -    char *remote_hostname;
       struct sockaddr_in *addr;
       size_t addr_len;
       int timeout; 
  
  
  
  1.12      +0 -10     apache-2.0/src/lib/apr/network_io/unix/sockets.c
  
  Index: sockets.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/sockets.c,v
  retrieving revision 1.11
  retrieving revision 1.12
  diff -u -d -u -r1.11 -r1.12
  --- sockets.c	1999/10/04 16:37:13	1.11
  +++ sockets.c	1999/10/08 19:44:31	1.12
  @@ -100,7 +100,6 @@
       }
    
       (*new)->socketdes = socket(AF_INET ,SOCK_STREAM, IPPROTO_TCP);
  -    (*new)->remote_hostname = NULL;
   
       (*new)->addr->sin_family = AF_INET;
   
  @@ -252,8 +251,6 @@
    */
   ap_status_t ap_accept(struct socket_t **new, const struct socket_t *sock)
   {
  -    struct hostent *hptr;
  -    
       (*new) = (struct socket_t *)ap_palloc(sock->cntxt, 
                               sizeof(struct socket_t));
   
  @@ -269,12 +266,6 @@
           return errno;
       }
       
  -    hptr = gethostbyaddr((char *)&(*new)->addr->sin_addr, 
  -                         sizeof(struct in_addr), AF_INET);
  -    if (hptr != NULL) {
  -        (*new)->remote_hostname = strdup(hptr->h_name);
  -    }
  -    
       ap_register_cleanup((*new)->cntxt, (void *)(*new), 
                           socket_cleanup, NULL);
       return APR_SUCCESS;
  @@ -316,7 +307,6 @@
           return errno;
       }
       else {
  -        sock->remote_hostname = strdup(hostname);
           return APR_SUCCESS;
       }
   }
  
  
  
  1.6       +14 -4     apache-2.0/src/lib/apr/network_io/unix/sockopt.c
  
  Index: sockopt.c
  ===================================================================
  RCS file: /home/cvs/apache-2.0/src/lib/apr/network_io/unix/sockopt.c,v
  retrieving revision 1.5
  retrieving revision 1.6
  diff -u -d -u -r1.5 -r1.6
  --- sockopt.c	1999/10/04 16:37:13	1.5
  +++ sockopt.c	1999/10/08 19:44:32	1.6
  @@ -64,6 +64,8 @@
   #include <netinet/in.h>
   #include <unistd.h>
   #include <fcntl.h>
  +#include <arpa/inet.h>
  +#include <netdb.h>
   
   static ap_status_t soblock(int sd)
   {
  @@ -201,11 +203,19 @@
    */
   ap_status_t ap_get_remote_hostname(char **name, struct socket_t *sock)
   {
  -    (*name) = ap_pstrdup(sock->cntxt, sock->remote_hostname);
  -    if (*name) {
  -        return APR_SUCCESS;
  +    struct hostent *hptr;
  +    
  +    hptr = gethostbyaddr((char *)&(sock->addr->sin_addr), 
  +                         sizeof(struct in_addr), AF_INET);
  +    if (hptr != NULL) {
  +        *name = ap_pstrdup(sock->cntxt, hptr->h_name);
  +        if (*name) {
  +            return APR_SUCCESS;
  +        }
  +        return APR_ENOMEM;
       }
  -    return APR_ENOMEM;
  +
  +    return errno;
   }
   
   
  
  
  

Mime
View raw message