Checked in matt's patches for TCP performance on Mac OS:
authorArt Cancro <ajc@citadel.org>
Mon, 15 Jan 2007 05:00:44 +0000 (05:00 +0000)
committerArt Cancro <ajc@citadel.org>
Mon, 15 Jan 2007 05:00:44 +0000 (05:00 +0000)
* Check for OSX/Darwin in configure and define accordingly (HAVE_DARWIN)
* Created stub functions for buffer_output,
unbuffer_output, flush_output in sysdep.c

citadel/acconfig.h
citadel/configure.ac
citadel/sysdep.c

index bcbc621c74c7e27a9f3887c06080167c4254e309..f3e96e6b071e98afee3a99879b0e9ae75c7eb77f 100644 (file)
@@ -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
 
index d7bd4ed5b70a9f1dfdc8adc91b3013da48d4cb37..c9ebd67cc946a014af79c84a2172d3736dfad6a8 100644 (file)
@@ -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)
index f679ad5be1141ded89cc74216dda50695c0de676..1d344029edfc1a9116c6b76b31f0a9f7dfc9e8e9 100644 (file)
@@ -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) {