httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeff Trawick <traw...@ibm.net>
Subject Re: cvs commit: apache-2.0/src/modules/mpm/mpmt_pthread mpmt_pthread.c
Date Fri, 23 Jun 2000 18:45:17 GMT
> From: trawick@locus.apache.org
> Date: 23 Jun 2000 18:02:18 -0000
> 
> trawick     00/06/23 11:02:17
> 
>   Modified:    src/modules/mpm/mpmt_pthread mpmt_pthread.c
>   Log:
>   Bring back the hokey call to ap_create_tcp_socket() so mpmt_pthread
>   works again.  It is completely hosed at the moment.
>   
>   Todo: remove the need for this call.

Recap of the basic issues:

  ap_poll() only works on ap_socket_t
  we want to use ap_poll() to wait on the pipe of death
  we need to use ap_put_os_sock() to create ap_socket_t from a
    descriptor
  ap_put_os_sock() calls getsockname() if it creates a new
    ap_socket_t, but doesn't if it stores the descriptor in an
    existing ap_socket_t
  getsockname() fails for non-sockets

My proposal:

  There are several places where we call getsockname() to fill in
  the local address: 

    ap_accept(), ap_connect(), ap_put_os_sock()

  Remove these calls to getsockname(), but set an indicator in the
  ap_socket_t to tell us that we need to do getsockname() before we 
  return that information, because we've done something to change the
  local address or (in the case of ap_put_os_sock()) we don't know the
  current state.

  Also, set the same indicator in ap_bind() because it makes a syscall
  which could change the socket name.

  In the functions where we return such info (ap_get_local_port(), 
  ap_get_local_ipaddr(),  ap_get_local_name()), if the indicator is
  set then first call getsockname() (and clear the indicator if
  successful).

This may seem a bit backwards, but the storage filled in by
getsockname() is also used by functions like ap_set_local_port(); we
want ap_set_local_port() followed by ap_get_local_port() to work the
same way it does today.

What does this mean...

. a little more logic in APR to reduce syscalls (not a real big deal)

. storing a pipe in an ap_socket_t works (until you try to do
  something socket-specific with it like ap_get_local_port)

. fix a current glitch where ap_get_local_port() after ap_bind() might
  not return the correct value  

-- 
Jeff Trawick | trawick@ibm.net | PGP public key at web site:
     http://www.geocities.com/SiliconValley/Park/9289/
          Born in Roswell... married an alien...

Mime
View raw message