* sysdep.c: unbuffer_output(): Split the writing part to a new function
authorMichael Hampton <io_error@uncensored.citadel.org>
Sun, 5 Sep 2004 15:20:41 +0000 (15:20 +0000)
committerMichael Hampton <io_error@uncensored.citadel.org>
Sun, 5 Sep 2004 15:20:41 +0000 (15:20 +0000)
  flush_output() for more precise control

citadel/ChangeLog
citadel/sysdep.c

index 36c45a6961957b33ca953fc2c6d01f20a9a4edb0..dc2b440ef201317814fad564d16b25b3964b0cd0 100644 (file)
@@ -1,4 +1,8 @@
  $Log$
+ Revision 625.11  2004/09/05 15:20:41  error
+ * sysdep.c: unbuffer_output(): Split the writing part to a new function
+   flush_output() for more precise control
+
  Revision 625.10  2004/09/03 04:34:30  ajc
  * setup.c: when creating an inittab entry for slapd, use "-d 0" instead
    of "-d 1" to avoid spewing messages to the console, while still remaining
@@ -6038,3 +6042,4 @@ Sat Jul 11 00:20:48 EDT 1998 Nathan Bryant <bryant@cs.usm.maine.edu>
 
 Fri Jul 10 1998 Art Cancro <ajc@uncensored.citadel.org>
        * Initial CVS import
+
index 8fb61866af905b81d3ebd1ee93774a3334bb5e11..5925aa6137bfcc3fb267e972a80d49db8945f3b8 100644 (file)
@@ -468,15 +468,24 @@ void buffer_output(void) {
 }
 
 /*
- * unbuffer_output()  ...  dump out all that output we've been buffering.
+ * flush_output()  ...   dump out all that output we've been buffering.
+ */
+void flush_output(void) {
+       if (CC->buffering == 1) {
+               client_write(CC->output_buffer, CC->buffer_len);
+               CC->buffer_len = 0;
+       }
+}
+
+/*
+ * unbuffer_output()  ...  stop buffering output.
  */
 void unbuffer_output(void) {
        if (CC->buffering == 1) {
+               flush_output();
                CC->buffering = 0;
-               client_write(CC->output_buffer, CC->buffer_len);
                free(CC->output_buffer);
                CC->output_buffer = NULL;
-               CC->buffer_len = 0;
        }
 }