From: Art Cancro Date: Mon, 15 Jan 2007 05:00:44 +0000 (+0000) Subject: Checked in matt's patches for TCP performance on Mac OS: X-Git-Tag: v7.86~3675 X-Git-Url: https://code.citadel.org/?a=commitdiff_plain;h=0dace6cab5590eaa0b5bbd687ef992feff7873f3;p=citadel.git Checked in matt's patches for TCP performance on Mac OS: * Check for OSX/Darwin in configure and define accordingly (HAVE_DARWIN) * Created stub functions for buffer_output, unbuffer_output, flush_output in sysdep.c --- diff --git a/citadel/acconfig.h b/citadel/acconfig.h index bcbc621c7..f3e96e6b0 100644 --- a/citadel/acconfig.h +++ b/citadel/acconfig.h @@ -37,6 +37,9 @@ /* define this if you have the libsieve mailbox filtering library available */ #undef HAVE_LIBSIEVE +/* define if using OS X/Darwin */ +#undef HAVE_DARWIN + /* define this if you have the newt window library available */ #undef HAVE_NEWT diff --git a/citadel/configure.ac b/citadel/configure.ac index d7bd4ed5b..c9ebd67cc 100644 --- a/citadel/configure.ac +++ b/citadel/configure.ac @@ -682,7 +682,19 @@ AC_CACHE_CHECK([under the bed], ac_cv_under_the_bed, [ ;; esac ]) - +AC_CANONICAL_HOST +AC_MSG_CHECKING([for reality distorion field]) +case "$host" in + dnl TCP buffering isn't ideal under OS X. This define should also be + dnl checked in other cases of OS X-Linux differences. + *-*-darwin*) + AC_DEFINE(HAVE_DARWIN) + AC_MSG_RESULT([present]) + ;; + *) + AC_MSG_RESULT([missing]) + ;; +esac dnl Done! Now write the Makefile and sysdep.h AC_SUBST(AUTH) AC_SUBST(CHKPWD) diff --git a/citadel/sysdep.c b/citadel/sysdep.c index f679ad5be..1d344029e 100644 --- a/citadel/sysdep.c +++ b/citadel/sysdep.c @@ -477,6 +477,7 @@ struct CitContext *CreateNewContext(void) { * native TCP buffering (Linux & *BSD), use that; otherwise, emulate it with * user-space buffering. */ +#ifndef HAVE_DARWIN #ifdef TCP_CORK # define HAVE_TCP_BUFFERING #else @@ -484,8 +485,8 @@ struct CitContext *CreateNewContext(void) { # define HAVE_TCP_BUFFERING # define TCP_CORK TCP_NOPUSH # endif -#endif - +#endif /* TCP_CORK */ +#endif /* HAVE_DARWIN */ #ifdef HAVE_TCP_BUFFERING static unsigned on = 1, off = 0; @@ -506,6 +507,16 @@ void flush_output(void) { setsockopt(ctx->client_socket, IPPROTO_TCP, TCP_CORK, &off, 4); setsockopt(ctx->client_socket, IPPROTO_TCP, TCP_CORK, &on, 4); } +#elif HAVE_DARWIN +/* Stub functions for Darwin/OS X where TCP buffering isn't liked at all */ +void buffer_output(void) { +CC->buffering = 0; +} +void unbuffer_output(void) { +CC->buffering = 0; +} +void flush_output(void) { +} #else void buffer_output(void) { if (CC->buffering == 0) {