apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From traw...@apache.org
Subject cvs commit: apr/network_io/win32 sockopt.c
Date Tue, 22 Oct 2002 20:05:35 GMT
trawick     2002/10/22 13:05:35

  Modified:    .        CHANGES
               include  apr_network_io.h
               include/arch/unix networkio.h
               network_io/unix sockopt.c
               network_io/win32 sockopt.c
  Log:
  map the TCP_NODELAY socket option to SCTP_NODELAY as appropriate
  
  Submitted by: Randall Stewart <randall@stewart.chicago.il.us>
  Reviewed by:  Jeff Trawick
  
  Revision  Changes    Path
  1.349     +4 -0      apr/CHANGES
  
  Index: CHANGES
  ===================================================================
  RCS file: /home/cvs/apr/CHANGES,v
  retrieving revision 1.348
  retrieving revision 1.349
  diff -u -r1.348 -r1.349
  --- CHANGES	22 Oct 2002 03:35:47 -0000	1.348
  +++ CHANGES	22 Oct 2002 20:05:34 -0000	1.349
  @@ -1,4 +1,8 @@
   Changes with APR 0.9.2
  +
  +  *) Add recognition of and socket API support for the SCTP protocol.
  +     [Randall Stewart <randall@stewart.chicago.il.us>]
  +
     *) Win32: apr_shutdown was not honoring apr_shutdown_how_e and
        always shutting down the socket for read. This could result
        in Apache HTTPD 2.0 clients getting early connection closures
  
  
  
  1.131     +3 -1      apr/include/apr_network_io.h
  
  Index: apr_network_io.h
  ===================================================================
  RCS file: /home/cvs/apr/include/apr_network_io.h,v
  retrieving revision 1.130
  retrieving revision 1.131
  diff -u -r1.130 -r1.131
  --- apr_network_io.h	18 Oct 2002 12:03:59 -0000	1.130
  +++ apr_network_io.h	22 Oct 2002 20:05:34 -0000	1.131
  @@ -103,7 +103,9 @@
   #define APR_SO_SNDBUF        64
   #define APR_SO_RCVBUF        128
   #define APR_SO_DISCONNECTED  256
  -#define APR_TCP_NODELAY      512
  +#define APR_TCP_NODELAY      512  /**< For SCTP sockets, this is mapped
  +                                   * to STCP_NODELAY internally.
  +                                   */
   #define APR_TCP_NOPUSH       1024
   #define APR_RESET_NODELAY    2048 /**< This flag is ONLY set internally
                                      * when we set APR_TCP_NOPUSH with
  
  
  
  1.56      +6 -0      apr/include/arch/unix/networkio.h
  
  Index: networkio.h
  ===================================================================
  RCS file: /home/cvs/apr/include/arch/unix/networkio.h,v
  retrieving revision 1.55
  retrieving revision 1.56
  diff -u -r1.55 -r1.56
  --- networkio.h	18 Oct 2002 12:03:59 -0000	1.55
  +++ networkio.h	22 Oct 2002 20:05:35 -0000	1.56
  @@ -87,6 +87,12 @@
   #if APR_HAVE_NETINET_TCP_H
   #include <netinet/tcp.h>
   #endif
  +#if APR_HAVE_NETINET_SCTP_UIO_H
  +#include <netinet/sctp_uio.h>
  +#endif
  +#if APR_HAVE_NETINET_SCTP_H
  +#include <netinet/sctp.h>
  +#endif
   #if APR_HAVE_NETINET_IN_H
   #include <netinet/in.h>
   #endif
  
  
  
  1.61      +21 -3     apr/network_io/unix/sockopt.c
  
  Index: sockopt.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/unix/sockopt.c,v
  retrieving revision 1.60
  retrieving revision 1.61
  diff -u -r1.60 -r1.61
  --- sockopt.c	22 Oct 2002 18:55:17 -0000	1.60
  +++ sockopt.c	22 Oct 2002 20:05:35 -0000	1.61
  @@ -232,7 +232,16 @@
       if (opt & APR_TCP_NODELAY) {
   #if defined(TCP_NODELAY)
           if (apr_is_option_set(sock->netmask, APR_TCP_NODELAY) != on) {
  -            if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY, (void *)&on,
sizeof(int)) == -1) {
  +            int optlevel = IPPROTO_TCP;
  +            int optname = TCP_NODELAY;
  +
  +#if APR_HAVE_SCTP
  +            if (sock->protocol == IPPROTO_SCTP) {
  +                optlevel = IPPROTO_SCTP;
  +                optname = SCTP_NODELAY;
  +            }
  +#endif
  +            if (setsockopt(sock->socketdes, optlevel, optname, (void *)&on, sizeof(int))
== -1) {
                   return errno;
               }
               apr_set_option(&sock->netmask, APR_TCP_NODELAY, on);
  @@ -253,6 +262,15 @@
       if (opt & APR_TCP_NOPUSH) {
   #if APR_TCP_NOPUSH_FLAG
           if (apr_is_option_set(sock->netmask, APR_TCP_NOPUSH) != on) {
  +            int optlevel = IPPROTO_TCP;
  +            int optname = TCP_NODELAY;
  +
  +#if APR_HAVE_SCTP
  +            if (sock->protocol == IPPROTO_SCTP) {
  +                optlevel = IPPROTO_SCTP;
  +                optname = SCTP_NODELAY;
  +            }
  +#endif
               /* OK we're going to change some settings here... */
               /* TCP_NODELAY is mutually exclusive, so do we have it set? */
               if (apr_is_option_set(sock->netmask, APR_TCP_NODELAY) == 1 && on)
{
  @@ -260,7 +278,7 @@
                    * flag set we need to switch it off...
                    */
                   int tmpflag = 0;
  -                if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY,
  +                if (setsockopt(sock->socketdes, optlevel, optname,
                                  (void*)&tmpflag, sizeof(int)) == -1) {
                       return errno;
                   }
  @@ -277,7 +295,7 @@
               apr_set_option(&sock->netmask, APR_TCP_NOPUSH, on);
               if (!on && apr_is_option_set(sock->netmask, APR_RESET_NODELAY))
{
                   int tmpflag = 1;
  -                if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY,
  +                if (setsockopt(sock->socketdes, optlevel, optname,
                                  (void*)&tmpflag, sizeof(int)) == -1) {
                       return errno;
                   }
  
  
  
  1.47      +10 -1     apr/network_io/win32/sockopt.c
  
  Index: sockopt.c
  ===================================================================
  RCS file: /home/cvs/apr/network_io/win32/sockopt.c,v
  retrieving revision 1.46
  retrieving revision 1.47
  diff -u -r1.46 -r1.47
  --- sockopt.c	22 Oct 2002 20:00:06 -0000	1.46
  +++ sockopt.c	22 Oct 2002 20:05:35 -0000	1.47
  @@ -194,7 +194,16 @@
       }
       case APR_TCP_NODELAY:
           if (apr_is_option_set(sock->netmask, APR_TCP_NODELAY) != on) {
  -            if (setsockopt(sock->socketdes, IPPROTO_TCP, TCP_NODELAY, 
  +            int optlevel = IPPROTO_TCP;
  +            int optname = TCP_NODELAY;
  +
  +#if APR_HAVE_SCTP
  +            if (sock->protocol == IPPROTO_SCTP) {
  +                optlevel = IPPROTO_SCTP;
  +                optname = SCTP_NODELAY;
  +            }
  +#endif
  +            if (setsockopt(sock->socketdes, optlevel, optname,
                              (void *)&on, sizeof(int)) == -1) {
                   return apr_get_netos_error();
               }
  
  
  

Mime
View raw message