Can you check this out? I tweaked your sockopt code for Unix just a
bit.
Index: include/apr_network_io.h
===================================================================
RCS file: /home/cvs/apr/include/apr_network_io.h,v
retrieving revision 1.130
diff -u -r1.130 apr_network_io.h
--- include/apr_network_io.h 18 Oct 2002 12:03:59 -0000 1.130
+++ include/apr_network_io.h 22 Oct 2002 19:09:11 -0000
@@ -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
Index: include/arch/unix/networkio.h
===================================================================
RCS file: /home/cvs/apr/include/arch/unix/networkio.h,v
retrieving revision 1.55
diff -u -r1.55 networkio.h
--- include/arch/unix/networkio.h 18 Oct 2002 12:03:59 -0000 1.55
+++ include/arch/unix/networkio.h 22 Oct 2002 19:09:11 -0000
@@ -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
Index: network_io/unix/sockopt.c
===================================================================
RCS file: /home/cvs/apr/network_io/unix/sockopt.c,v
retrieving revision 1.60
diff -u -r1.60 sockopt.c
--- network_io/unix/sockopt.c 22 Oct 2002 18:55:17 -0000 1.60
+++ network_io/unix/sockopt.c 22 Oct 2002 19:09:12 -0000
@@ -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;
}
--
Jeff Trawick | [EMAIL PROTECTED]
Born in Roswell... married an alien...