Author: mhabersack
Date: 2007-10-01 15:08:52 -0400 (Mon, 01 Oct 2007)
New Revision: 86721

Modified:
   trunk/mod_mono/ChangeLog
   trunk/mod_mono/man/mod_mono.8.in
   trunk/mod_mono/src/mod_mono.c
Log:
2007-10-01  Marek Habersack  <[EMAIL PROTECTED]>

        * src/mod_mono.c: implemented support for flushing the Apache
        output buffers on every write, configurable via the
        MonoFlushOnWrite directive.

        * man/mod_mono.8.in: added documentation of the MonoFlushOnWrite
        directive.


Modified: trunk/mod_mono/ChangeLog
===================================================================
--- trunk/mod_mono/ChangeLog    2007-10-01 18:43:20 UTC (rev 86720)
+++ trunk/mod_mono/ChangeLog    2007-10-01 19:08:52 UTC (rev 86721)
@@ -1,3 +1,12 @@
+2007-10-01  Marek Habersack  <[EMAIL PROTECTED]>
+
+       * src/mod_mono.c: implemented support for flushing the Apache
+       output buffers on every write, configurable via the
+       MonoFlushOnWrite directive.
+
+       * man/mod_mono.8.in: added documentation of the MonoFlushOnWrite
+       directive.
+
 2007-09-27  Marek Habersack  <[EMAIL PROTECTED]>
 
        * man/mod_mono.8.in: document the restart options as Apache 2.0+

Modified: trunk/mod_mono/man/mod_mono.8.in
===================================================================
--- trunk/mod_mono/man/mod_mono.8.in    2007-10-01 18:43:20 UTC (rev 86720)
+++ trunk/mod_mono/man/mod_mono.8.in    2007-10-01 19:08:52 UTC (rev 86721)
@@ -145,8 +145,15 @@
 .TP
 .I "MonoDebug"
 Runs mono in debug mode, which produces stack traces with line numbers.
-Default value: false.
+Default value: False.
 .TP
+.I "MonoFlushOnWrite"
+If MonoFlushOnWrite is true, mod_mono will flush the Apache output buffers on 
+every write. Note that Apache2 supports a notion of output filters, which will 
be 
+invoked on every write if this option is set to true. This may have a severe 
impact 
+on your application performance. 
+Default: False
+.TP
 .I "MonoSetServerAlias"
 Takes a server alias name. This is to be used inside <Directory> or
 <Location>.

Modified: trunk/mod_mono/src/mod_mono.c
===================================================================
--- trunk/mod_mono/src/mod_mono.c       2007-10-01 18:43:20 UTC (rev 86720)
+++ trunk/mod_mono/src/mod_mono.c       2007-10-01 19:08:52 UTC (rev 86721)
@@ -84,6 +84,7 @@
        char *max_cpu_time;
        char *max_memory;
        char *debug;
+       char *flushOnWrite;
        char *env_vars;
        char status; /* One of the FORK_* in the enum above.
                      * Don't care if run_xsp is "false" */
@@ -710,7 +711,7 @@
 }
 
 static void
-request_send_response_from_memory (request_rec *r, char *byteArray, int size)
+request_send_response_from_memory (request_rec *r, char *byteArray, int size, 
int doFlush)
 {
 #ifdef APACHE13
        if (r->sent_bodyct == 0)
@@ -718,12 +719,16 @@
 #endif
 
        ap_rwrite (byteArray, size, r);
+       if (doFlush) {
+               DEBUG_PRINT (0, "flushing");
+               ap_rflush (r);
+       }
 }
 
 static void
 request_send_response_string (request_rec *r, char *byteArray)
 {
-       request_send_response_from_memory (r, byteArray, strlen (byteArray));
+       request_send_response_from_memory (r, byteArray, strlen (byteArray), 0);
 }
 
 /* Not connection because actual port will vary depending on Apache 
configuration */
@@ -999,7 +1004,7 @@
 }
 
 static int
-do_command (int command, apr_socket_t *sock, request_rec *r, int *result)
+do_command (int command, apr_socket_t *sock, request_rec *r, int *result, int 
doFlush)
 {
        int32_t size;
        char *str;
@@ -1028,7 +1033,7 @@
                                apr_pool_destroy (temp_pool);
                                break;
                        }
-                       request_send_response_from_memory (r, str, size);
+                       request_send_response_from_memory (r, str, size, 
doFlush);
                        apr_pool_destroy (temp_pool);
                        break;
                case GET_SERVER_VARIABLES:
@@ -2023,8 +2028,10 @@
        do {
                input = read_data (sock, (char *) &command, sizeof (int32_t));
                if (input == sizeof (int32_t)) {
+                       int doFlush = conf->flushOnWrite && (strcasecmp 
(conf->flushOnWrite, "True") == 0);
+                       
                        command = INT_FROM_LE (command);
-                       result = do_command (command, sock, r, &status);
+                       result = do_command (command, sock, r, &status, 
doFlush);
                }
        } while (input == sizeof (int32_t) && result == TRUE);
 
@@ -2696,6 +2703,12 @@
        MAKE_CMD12 (MonoAutoRestartTime, restart_time,
                    "Time after which the backend should be auto-restarted. The 
time format is: "
                    "DD[:HH[:MM[:SS]]]. Default value: 00:12:00:00"),
+       MAKE_CMD12 (MonoFlushOnWrite, flushOnWrite,
+                   "If MonoFlushOnWrite is true, mod_mono will flush the 
Apache output buffers on "
+                   "every write. Note that Apache2 supports a notion of output 
filters, which will be "
+                   "invoked on every write if this option is set to true. This 
may have a severe impact "
+                   "on your application performance. "
+                   "Default: False"),
        { NULL }
 };
 

_______________________________________________
Mono-patches maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/mono-patches

Reply via email to