[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

IPv6 oddness in ra_svn

From: Max Bowsher <maxb_at_ukf.net>
Date: 2005-03-22 11:39:11 CET

Why does the ipv6_supported variable exist at all in the below code?

==============================================================================
{
  apr_sockaddr_t *sa;
  apr_status_t status;
  int family = APR_INET;
  int ipv6_supported = APR_HAVE_IPV6;

  /* Make sure we have IPV6 support first before giving
apr_sockaddr_info_get
     APR_UNSPEC, because it may give us back an IPV6 address even if we
can't
     create IPV6 sockets. */

#if APR_HAVE_IPV6
  if (ipv6_supported)
    {
#ifdef MAX_SECS_TO_LINGER
      status = apr_socket_create(sock, APR_INET6, SOCK_STREAM, pool);
#else
      status = apr_socket_create(sock, APR_INET6, SOCK_STREAM,
                                 APR_PROTO_TCP, pool);
#endif
      if (status != 0)
        ipv6_supported = 0;
      else
        {
          apr_socket_close(*sock);
          family = APR_UNSPEC;
        }
    }
#endif
==============================================================================

Couldn't it be removed entirely with *NO* change to the functioning of the
code at all, like so:

==============================================================================
{
  apr_sockaddr_t *sa;
  apr_status_t status;
  int family = APR_INET;

  /* Make sure we have IPV6 support first before giving
apr_sockaddr_info_get
     APR_UNSPEC, because it may give us back an IPV6 address even if we
can't
     create IPV6 sockets. */

#if APR_HAVE_IPV6
#ifdef MAX_SECS_TO_LINGER
      status = apr_socket_create(sock, APR_INET6, SOCK_STREAM, pool);
#else
      status = apr_socket_create(sock, APR_INET6, SOCK_STREAM,
                                 APR_PROTO_TCP, pool);
#endif
      if (status == 0)
        {
          apr_socket_close(*sock);
          family = APR_UNSPEC;
        }
#endif
==============================================================================

Thoughts?

Max.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Mar 22 11:42:48 2005

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.